Memory system for flushing and relocating data

ABSTRACT

A system includes: a first input buffer that functions as an input buffer for a third storing area; and a second input buffer that functions as an input buffer for the third storing area and that separately stores data with a high update frequency for the third storing area. In the system, a plurality of data written in a first storing area or a second storing area are flushed to the first input buffer in units of logical blocks. Also, a plurality of data written in the first input buffer are relocated to the third storing area in units of logical blocks.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is based upon and claims the benefit of priority fromthe prior Japanese Patent Application No. 2008-51475, filed on Mar. 1,2008 and the prior Japanese Patent Application No. 2008-63404, filed onMarch 12; the entire contents of which are incorporated herein byreference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a memory system including a nonvolatilesemiconductor memory.

2. Description of the Related Art

The SSD includes a plurality of flash memory chips, a controller thatperforms read/write control for the respective flash memory chips inresponse to a request from a host apparatus, a buffer memory forperforming data transfer between the respective flash memory chips andthe host apparatus, a power supply circuit, and a connection interfaceto the host apparatus (for example, Japanese Patent No. 3688835).

Examples of the nonvolatile semiconductor memory include nonvolatilesemiconductor memories in which a unit of erasing, writing, and readoutis fixed such as a nonvolatile semiconductor memory that, in storingdata, once erases the data in block units and then performs writing anda nonvolatile semiconductor memory that performs writing and readout inpage units in the same manner as the NAND-type flash memory.

On the other hand, a unit for a host apparatus such as a personalcomputer to write data in and read out the data from a secondary storagedevice such as a hard disk is called sector. The sector is setindependently from a unit of erasing, writing, and readout of asemiconductor storage device.

For example, whereas a size of a block (a block size) of the nonvolatilesemiconductor memory is 512 kB and a size of a page (a page size)thereof is 4 kB, a size of a sector (a sector size) of the hostapparatus is set to 512 B.

In this way, the unit of erasing, writing, and readout of thenonvolatile semiconductor memory may be larger than the unit of writingand readout of the host apparatus.

Therefore, when the secondary storage device of the personal computersuch as the hard disk is configured by using the nonvolatilesemiconductor memory, it is necessary to write data with a small sizefrom the personal computer as the host apparatus by adapting the size tothe block size and the page size of the nonvolatile semiconductormemory.

The data recorded by the host apparatus such as the personal computerhas both temporal locality and spatial locality (see, for example, DavidA. Patterson and John L. Hennessy, “Computer Organization and Design:The Hardware/Software Interface”, Morgan Kaufmann Publishers, Aug. 31,2004). Therefore, when data is recorded, if the data is directlyrecorded in an address designated from the outside, rewriting, i.e.,erasing processing temporally concentrates in a specific area and a biasin the number of times of erasing increases. Therefore, in the NAND-typeflash memory, processing called wear leveling for equally distributingdata update sections is performed.

In the wear leveling processing, for example, a logical addressdesignated by the host apparatus is translated into a physical addressof the nonvolatile semiconductor memory in which the data updatesections are equally distributed.

When a large-capacity secondary storage device is configured by usingthe NAND flash memory, in performing the address translation, if a unitof the data management is a small size (e.g., the page size), the sizeof management tables increases and does not fit in a main memory of acontroller of the secondary storage device. Address translation cannotbe performed at high speed. In this way, the size of the managementtables inevitably increases according to an increase in capacity of theNAND flash memory as the secondary storage device. Therefore, there is ademand for a method of reducing a capacity of the management tables asmuch as possible.

As explained above, when a data erasing unit (a block) and a datamanagement unit are different, according to the progress of rewriting ofthe flash memory, blocks are made porous by invalid (non-latest) data.When the blocks in such a porous state increases, substantially usableblocks decrease and a storage area of the flash memory cannot beeffectively used. Therefore, processing called compaction for collectingvalid latest data and rewriting the data in different blocks isperformed. The compaction processing may take a long time, depending onthe method being used. Thus, a method for shortening the compactionprocessing time is in demand.

Also, with regard to deterioration of the cells in a flash memory, oneof the important factors is the amount of data that needs to be erasedfrom the blocks in the flash memory in relation to the amount of datathat is written to the flash memory from the host apparatus side. Theamount of data erased from the blocks in relation to the amount of datawritten to the flash memory from the host apparatus represents writingefficiency. The smaller a writing efficiency value is, the higher is thewriting efficiency. Generally speaking, in NAND-type flash memories, alot of time is spent on the processes to erase data from the blocks andto write data into the blocks. Thus, when the writing efficiency is low,it means that the amount of data erased from the blocks and the amountof data written to the erased blocks are large, in relation to theamount of data written to the flash memory from the host apparatus. Italso means that the speed performance of the flash memory is lowered. Asexplained here, a method for improving the writing efficiency by keepingthe amount of data written to a flash memory closer to the amount ofdata erased from the blocks is also in demand.

To achieve the objects described above, a technique has been disclosedby which another block called a “log block” is kept in correspondencewith each of the blocks in which data is stored (i.e., data blocks)(see, for example, Japanese Patent Application Laid-open No.2002-366423). According to this technique, to improve the writingefficiency, data is written into free pages within the log block so thatwhen the log block no longer has a free page or when there is not enoughlog block area, the data stored in the log block is reflected into thedata block (i.e., merge processing).

However, one of the problems with this technique is that, because thedata blocks and the log blocks are provided in a one-to-onecorrespondence, the number of blocks that can be updated at the sametime is limited to the number of log blocks. In other words, when datahaving a small size is written into each of a large number of blocks,the merge processing is performed while the log blocks still have manyfree pages. As a result, the writing efficiency cannot be improved.

BRIEF SUMMARY OF THE INVENTION

A memory system according to an embodiment of the present inventioncomprises: a first storing area as a cache memory included in a volatilesemiconductor memory;

second and third storing areas included in a nonvolatile semiconductormemory in which data reading and writing is performed by a page unit anddata erasing is performed by a physical block unit that is twice orlarger natural number times as large as the page unit; a first inputbuffer included in the nonvolatile semiconductor memory that functionsas an input buffer for the third storing area; a second input bufferincluded in the nonvolatile semiconductor memory that functions as aninput buffer for the third storing area and that separately stores datawith a high update frequency for the third storing area; and acontroller that allocates a storage area of the nonvolatilesemiconductor memory to the second and third storing areas in logicalblock unit associated with one or more of physical blocks, wherein thecontroller executes: first processing for flushing a plurality of datain sector unit written in the first storing area to the second storingarea as data in first management unit; second processing for flushingthe plurality of data written in the first storing area to the secondinput buffer in second management unit as data in second management unitthat is twice or a larger natural number times as large as the firstmanagement unit; third processing for flushing the plurality of datawritten in the first storing area to the first input buffer in logicalblock unit as data in the second management unit; fourth processing forflushing a plurality of data written in the second storing area to thefirst input buffer in logical block unit; fifth processing forrelocating a plurality of data written in the first input buffer to thethird storing area in logical block unit; and sixth processing forrelocating a plurality of data written in the second input buffer to thethird storing area.

According to an aspect of the present invention, it is possible toprovide a memory system that is able to increase the speed of the writeprocessing and to improve the writing efficiency.

A memory system according to another embodiment of the present inventioncomprises: a first storing area as a cache memory included in a volatilesemiconductor memory; second and third storing areas included in anonvolatile semiconductor memory in which data reading and writing isperformed by a page unit and data erasing is performed by a physicalblock unit that is twice or larger natural number times as large as thepage unit; a controller that allocates a storage area of the nonvolatilesemiconductor memory to the second and third storing areas in logicalblock unit associated with one or more of physical blocks, wherein thecontroller executes: first processing for flushing a plurality of datain sector unit written in the first storing area to the second storingarea as data in first management unit; second processing for flushing aplurality of data written in the first storing area to the third storingarea in second management unit that is twice or a larger natural numbertimes as large as the first management unit; third processing forselecting a plurality of valid data in the first management unit storedin the second storing area and rewriting the valid data into a newlogical block; and fourth processing for flushing, before executing thethird processing, a plurality of data written in the second storing areato the third storing area in logical block unit.

According to another aspect of the present invention, it is possible toprovide a memory system that is able to shorten the compactionprocessing time.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a configuration example of an SSD;

FIG. 2A is a circuit diagram of a configuration example of one blockincluded in a NAND memory chip and FIG. 2B is a schematic diagram of athreshold distribution in a quaternary data storage system;

FIG. 3 is a block diagram of a hardware internal configuration exampleof a drive control circuit;

FIG. 4 is a block diagram of a functional configuration example of aprocessor;

FIG. 5 is a block diagram of a functional configuration formed in a NANDmemory and a DRAM;

FIG. 6 is a detailed functional block diagram related to writeprocessing from a WC to the NAND memory;

FIG. 7 is a diagram of an LBA logical address;

FIG. 8 is a diagram of a configuration example of a management table ina data managing unit;

FIG. 9 is a diagram of an example of an RC cluster management table;

FIG. 10 is a diagram of an example of a WC cluster management table;

FIG. 11 is a diagram of an example of a WC track management table;

FIG. 12 is a diagram of an example of a track management table;

FIG. 13 is a diagram of an example of an FS/IS management table;

FIG. 14 is a diagram of an example of an MS logical block managementtable;

FIG. 15 is a diagram of an example of an FS/IS logical block managementtable;

FIG. 16 is a diagram of an example of an intra-FS/IS cluster managementtable;

FIG. 17 is a diagram of an example of a logical-to-physical translationtable;

FIG. 18 is a flowchart of an operation example of read processing;

FIG. 19 is a flowchart of an operation example of write processing;

FIG. 20 is a diagram of combinations of inputs and outputs in a flow ofdata among components and causes of the flow;

FIG. 21 is a more detailed functional block diagram related to the writeprocessing from the WC to the NAND memory;

FIG. 22 is a diagram of another configuration example of a managementtable in a data managing unit;

FIG. 23 is a diagram of a diagram of a relation among parallel operationelements, planes, and channels;

FIG. 24 is a diagram of another example of the logical-to-physicaltranslation table;

FIG. 25 is a diagram of an example of a BB management table;

FIG. 26 is a diagram of an internal configuration example of an FBmanagement table;

FIG. 27 is a diagram of a correspondence relation between logical blocksand physical blocks of the NAND memory;

FIG. 28 is a diagram of an example of an MS structure management table;

FIG. 29 is a diagram of an example of an FS/IS structure managementtable;

FIG. 30 is a detailed flowchart of an operation example of writeprocessing;

FIG. 31 is a flowchart of an example of an flush operation of an IS;

FIG. 32 is a perspective view of an example of a personal computer; and

FIG. 33 is a diagram of an example of system architecture in a personalcomputer.

DETAILED DESCRIPTION OF THE INVENTION

Exemplary embodiments of Memory System according to the presentinvention will be explained below in detail with reference to theaccompanying drawings. The present invention is not limited to thefollowing embodiments.

EMBODIMENTS

Embodiments of the present invention are explained below with referenceto the drawings. In the following explanation, components having thesame functions and configurations are denoted by the same referencenumerals and signs. Redundant explanation of the components is performedonly when necessary.

First, terms used in this specification are defined.

Physical page: A unit that can be collectively written and read out in aNAND memory chip. A physical page size is, for example, 4 kB. However, aredundant bit such as an error correction code added to main data (userdata, etc.) in an SSD is not included. Usually, 4 kB+redundant bit(e.g., several 10 B) is a unit simultaneously written in a memory cell.However, for convenience of explanation, the physical page is defined asexplained above.

Logical page: A writing and readout unit set in the SSD. The logicalpage is associated with one or more physical pages. A logical page sizeis, for example, 4 kB in an 8-bit normal mode and is 32 kB in a 32-bitdouble speed mode. However, a redundant bit is not included.

Physical block: A minimum unit that can be independently erased in theNAND memory chip. The physical block includes a plurality of physicalpages. A physical block size is, for example, 512 kB. However, aredundant bit such as an error correction code added to main data in theSSD is not included. Usually, 512 kB+redundant bit (e.g., several 10 kB)is a unit simultaneously erased. However, for convenience ofexplanation, the physical block is defined as explained above.

Logical block: An erasing unit set in the SSD. The logical block isassociated with one or more physical blocks. A logical block size is,for example, 512 kB in an 8-bit normal mode and is 4 MB in a 32-bitdouble speed mode. However, a redundant bit is not included.

Sector: A minimum access unit from a host. A sector size is, forexample, 512 B.

Cluster: A management unit for managing “small data (fine grained data)”in the SSD. A cluster size is equal to or larger than the sector size,and for example, is set such that a size twice or larger natural numbertimes as large as the cluster size is the logical page size.

Track: A management unit for managing “large data (coarse grained data)”in the SSD. A track size is set such that a size twice or larger naturalnumber times as large as the cluster size is the track size, and forexample, a size twice or larger natural number times as large as thetrack size is the logical block size.

Free block (FB): A logical block on a NAND-type flash memory for which ause is not allocated. When a use is allocated to the free block, thefree block is used after being erased.

Bad block (BB): A physical block on the NAND-type flash memory thatcannot be used as a storage area because of a large number of errors.For example, a physical block for which an erasing operation is notnormally finished is registered as the bad block BB.

Writing efficiency: A statistical value of an erasing amount of thelogical block with respect to a data amount written from the host in apredetermined period. As the writing efficiency is smaller, a weardegree of the NAND-type flash memory is smaller.

Valid cluster: A cluster that stores latest data corresponding to alogical address.

Invalid cluster: A cluster that stores non-latest data not to bereferred as a result that a cluster having identical logical address iswritten in other storage area.

Valid track: A track that stores latest data corresponding to a logicaladdress.

Invalid track: A track that stores non-latest data not to be referred asa result that a cluster having identical logical address is written inother storage area.

Compaction: Extracting only the valid cluster and the valid track from alogical block in the management object and rewriting the valid clusterand the valid track in a new logical block.

First Embodiment

FIG. 1 is a block diagram of a configuration example of an SSD (SolidState Drive) 100. The SSD 100 is connected to a host apparatus 1 such asa personal computer or a CPU core via a memory connection interface suchas an ATA interface (ATA I/F) 2 and functions as an external storage ofthe host apparatus 1. The SSD 100 can transmit data to and receive datafrom an apparatus for debugging and manufacture inspection 200 via acommunication interface 3 such as an RS232C interface (RS232C I/F). TheSSD 100 includes a NAND-type flash memory (hereinafter abbreviated asNAND memory) 10 as a nonvolatile semiconductor memory, a drive controlcircuit 4 as a controller, a DRAM 20 as a volatile semiconductor memory,a power supply circuit 5, an LED for state display 6, a temperaturesensor 7 that detects the temperature in a drive, and a fuse 8.

The power supply circuit 5 generates a plurality of different internalDC power supply voltages from external DC power supplied from a powersupply circuit on the host apparatus 1 side and supplies these internalDC power supply voltages to respective circuits in the SSD 100. Thepower supply circuit 5 detects a rising edge of an external powersupply, generates a power-on reset signal, and supplies the power-onreset signal to the drive control circuit 4. The fuse 8 is providedbetween the power supply circuit on the host apparatus 1 side and thepower supply circuit 5 in the SSD 100. When an overcurrent is suppliedfrom an external power supply circuit, the fuse 8 is disconnected toprevent malfunction of the internal circuits.

The NAND memory 10 has four parallel operation elements 10 a to 10 dthat perform four parallel operations. One parallel operation elementhas two NAND memory packages. Each of the NAND memory packages includesa plurality of stacked NAND memory chips (e.g., 1 chip=2 GB). In thecase of FIG. 1, each of the NAND memory packages includes stacked fourNAND memory chips. The NAND memory 10 has a capacity of 64 GB. When eachof the NAND memory packages includes stacked eight NAND memory chips,the NAND memory 10 has a capacity of 128 GB.

The DRAM 20 functions as a cache for data transfer between the hostapparatus 1 and the NAND memory 10 and a memory for a work area. AnFeRAM (Ferroelectric Random Access Memory), PRAM (Phase-change RandomAccess Memory), or MRAM (Magnetoresistive Random Access Memory) can beused instead of the DRAM 20. The drive control circuit 4 performs datatransfer control between the host apparatus 1 and the NAND memory 10 viathe DRAM 20 and controls the respective components in the SSD 100. Thedrive control circuit 4 supplies a signal for status display to the LEDfor state display 6. The drive control circuit 4 also has a function ofreceiving a power-on reset signal from the power supply circuit 5 andsupplying a reset signal and a clock signal to respective units in theown circuit and the SSD 100.

Each of the NAND memory chips is configured by arraying a plurality ofphysical blocks as units of data erasing. FIG. 2A is a circuit diagramof a configuration example of one physical block included in the NANDmemory chip. Each physical block includes (p+1) NAND strings arrayed inorder along an X direction (p is an integer equal to or larger than 0).A drain of a selection transistor ST1 included in each of the (p+1) NANDstrings is connected to bit lines BL0 to BLp and a gate thereof isconnected to a selection gate line SGD in common. A source of aselection transistor ST2 is connected to a source line SL in common anda gate thereof is connected to a selection gate line SGS in common.

Each of memory cell transistors MT includes a MOSFET (Metal OxideSemiconductor Field Effect Transistor) including the stacked gatestructure formed on a semiconductor substrate. The stacked gatestructure includes a charge storage layer (a floating gate electrode)formed on the semiconductor substrate via a gate insulating film and acontrol gate electrode formed on the charge storage layer via aninter-gate insulating film. Threshold voltage changes according to thenumber of electrons accumulated in the floating gate electrode. Thememory cell transistor MT stores data according to a difference in thethreshold voltage. The memory cell transistor MT can be configured tostore one bit or can be configured to store multiple values (data equalto or larger than two bits).

The memory cell transistor MT is not limited to the structure having thefloating gate electrode and can be the structure such as a MONOS(Metal-Oxide-Nitride-Oxide-Silicon) type that can adjust a threshold bycausing a nitride film interface as a charge storage layer to trapelectrons. Similarly, the memory cell transistor MT of the MONOSstructure can be configured to store one bit or can be configured tostore multiple values (data equal to or larger than two bits).

In each of the NAND strings, (q+1) memory cell transistors MT arearranged between the source of the selection transistor ST1 and thedrain of the selection transistor ST2 such that current paths thereofare connected in series. In other words, the memory cell transistors MTare connected in series in a Y direction such that adjacent ones of thememory cell transistors MT share a diffusion region (a source region ora drain region).

Control gate electrodes of the memory cell transistors MT are connectedto word lines WL0 to WLq, respectively, in order from the memory celltransistor MT located on the most drain side. Therefore, a drain of thememory cell transistor MT connected to the word line WL0 is connected tothe source of the selection transistor ST1. A source of the memory celltransistor MT connected to the word line WLq is connected to the drainof the selection transistor ST2.

The word lines WL0 to WLq connect the control gate electrodes of thememory cell transistors MT in common among the NAND strings in thephysical block. In other words, the control gates of the memory celltransistors MT present in an identical row in the block are connected toan identical word line WL. (p+1) memory cell transistors MT connected tothe identical word line WL is treated as one page (physical page). Datawriting and data readout are performed by each physical page.

The bit lines BL0 to BLp connect drains of selection transistors ST1 incommon among the blocks. In other words, the NAND strings present in anidentical column in a plurality of blocks are connected to an identicalbit line BL.

FIG. 2B is a schematic diagram of a threshold distribution, for example,in a quaternary data storage mode for storing two bits in one memorycell transistor MT. In the quaternary data storage mode, any one ofquaternary data “xy” defined by upper page data “x” and lower page data“y” can be stored in the memory cell transistor MT.

As the quaternary data “xy”, for example, “11”, “01”, “00”, and “10” areallocated in order of threshold voltages of the memory cell transistorMT. The data “11” is an erased state in which the threshold voltage ofthe memory cell transistor MT is negative.

In a lower page writing operation, the data “10” is selectively writtenin the memory cell transistor MT having the data “11” (in the erasedstate) according to the writing of the lower bit data “y”. A thresholddistribution of the data “10” before upper page writing is located aboutin the middle of threshold distributions of the data “01” and the data“00” after the upper page writing and can be broader than a thresholddistribution after the upper page writing. In a upper page writingoperation, writing of upper bit data “x” is selectively applied to amemory cell of the data “11” and a memory cell of the data “10”. Thedata “01” and the data “00” are written in the memory cells.

FIG. 3 is a block diagram of a hardware internal configuration exampleof the drive control circuit 4. The drive control circuit 4 includes adata access bus 101, a first circuit control bus 102, and a secondcircuit control bus 103. A processor 104 that controls the entire drivecontrol circuit 4 is connected to the first circuit control bus 102. Aboot ROM 105, in which a boot program for booting respective managementprograms (FW: firmware) stored in the NAND memory 10 is stored, isconnected to the first circuit control bus 102 via a ROM controller 106.A clock controller 107 that receives the power-on rest signal from thepower supply circuit 5 shown in FIG. 1 and supplies a reset signal and aclock signal to the respective units is connected to the first circuitcontrol bus 102.

The second circuit control bus 103 is connected to the first circuitcontrol bus 102. An I²C circuit 108 for receiving data from thetemperature sensor 7 shown in FIG. 1, a parallel IO (PIO) circuit 109that supplies a signal for status display to the LED for state display6, and a serial IO (SIO) circuit 110 that controls the RS232C I/F 3 areconnected to the second circuit control bus 103.

An ATA interface controller (ATA controller) 111, a first ECC (ErrorChecking and Correction) circuit 112, a NAND controller 113, and a DRAMcontroller 114 are connected to both the data access bus 101 and thefirst circuit control bus 102. The ATA controller 111 transmits data toand receives data from the host apparatus 1 via the ATA interface 2. AnSRAM 115 used as a data work area and a firm ware expansion area isconnected to the data access bus 101 via an SRAM controller 116. Whenthe firmware stored in the NAND memory 10 is started, the firmware istransferred to the SRAM 115 by the boot program stored in the boot ROM105.

The NAND controller 113 includes a NAND I/F 117 that performs interfaceprocessing for interface with the NAND memory 10, a second ECC circuit118, and a DMA controller for DMA transfer control 119 that performsaccess control between the NAND memory 10 and the DRAM 20. The secondECC circuit 118 performs encode of a second correction code and performsencode and decode of a first error correction code. The first ECCcircuit 112 performs decode of a second error correction code. The firsterror correction code and the second error correction code are, forexample, a hamming code, a BCH (Bose Chaudhuri Hocqenghem) code, an RS(Reed Solomon) code, or an LDPC (Low Density Parity Check) code.Correction ability of the second error correction code is higher thancorrection ability of the first error correction code.

As shown in FIGS. 1 and 3, in the NAND memory 10, the four paralleloperation elements 10 a to 10 d are connected in parallel to the NANDcontroller 112 in the drive control circuit 4 via four eight-bitchannels (4 ch). Three kinds of access modes explained below areprovided according to a combination of whether the four paralleloperation elements 10 a to 10 d are independently actuated or actuatedin parallel and whether a double speed mode (Multi Page Program/MultiPage Read/Multi Block Erase) provided in the NAND memory chip is used.

(1) 8-Bit Normal Mode

An 8-bit normal mode is a mode for actuating only one channel andperforming data transfer in 8-bit units. Writing and readout areperformed in the physical page size (4 kB). Erasing is performed in thephysical block size (512 kB). One logical block is associated with onephysical block and a logical block size is 512 kB.

(2) 32-Bit Normal Mode

A 32-bit normal mode is a mode for actuating four channels in paralleland performing data transfer in 32-bit units. Writing and readout areperformed in the physical page size×4 (16 kB). Erasing is performed inthe physical block size×4 (2 MB). One logical block is associated withfour physical blocks and a logical block size is 2 MB.

(3) 32-Bit Double Speed Mode

A 32-bit double speed mode is a mode for actuating four channels inparallel and performing writing and readout using a double speed mode ofthe NAND memory chip. Writing and readout are performed in the physicalpage size×4×2 (32 kB). Erasing is performed in the physical blocksize×4×2 (4 MB). One logical block is associated with eight physicalblocks and a logical block size is 4 MB.

In the 32-bit normal mode or the 32-bit double speed mode for actuatingfour channels in parallel, four or eight physical blocks operating inparallel are erasing units for the NAND memory 10 and four or eightphysical pages operating in parallel are writing units and readout unitsfor the NAND memory 10. In operations explained below, basically, the32-bit double speed mode is used. For example, it is assumed that onelogical block=4 MB=2^(i) tracks=2^(j) pages=2^(k) clusters=2^(l) sectors(i, j, k, and l are natural numbers and a relation of i<j<k<1 holds).

A logical block accessed in the 32-bit double speed mode is accessed in4 MB units. Eight (2×4ch) physical blocks (one physical block=512 kB)are associated with the logical block. When the bad block BB managed inphysical block units is detected, the bad block BB is unusable.Therefore, in such a case, a combination of the eight physical blocksassociated with the logical block is changed to not include the badblock BB.

FIG. 4 is a block diagram of a functional configuration example offirmware realized by the processor 104. Functions of the firmwarerealized by the processor 104 are roughly classified into a datamanaging unit 120, an ATA-command processing unit 121, a securitymanaging unit 122, a boot loader 123, an initialization managing unit124, and a debug supporting unit 125.

The data managing unit 120 controls data transfer between the NANDmemory 10 and the DRAM 20 and various functions concerning the NANDmemory 10 via the NAND controller 112 and the first ECC circuit 114. TheATA-command processing unit 121 performs data transfer processingbetween the DRAM 20 and the host apparatus 1 in cooperation with thedata managing unit 120 via the ATA controller 110 and the DRAMcontroller 113. The security managing unit 122 manages various kinds ofsecurity information in cooperation with the data managing unit 120 andthe ATA-command processing unit 121.

The boot loader 123 loads, when a power supply is turned on, themanagement programs (firmware) from the NAND memory 10 to the SRAM 120.The initialization managing unit 124 performs initialization ofrespective controllers and circuits in the drive control circuit 4. Thedebug supporting unit 125 processes data for debug supplied from theoutside via the RS232C interface. The data managing unit 120, theATA-command processing unit 121, and the security managing unit 122 aremainly functional units realized by the processor 104 executing themanagement programs stored in the SRAM 114.

In this embodiment, functions realized by the data managing unit 120 aremainly explained. The data managing unit 120 performs, for example,provision of functions that the ATA-command processing unit 121 requeststhe NAND memory 10 and the DRAM 20 as storage devices to provide (inresponse to various commands such as a Write request, a Cache Flushrequest, and a Read request from the host apparatus), management of acorrespondence relation between a host address region and the NANDmemory 10 and protection of management information, provision of fastand highly efficient data readout and writing functions using the DRAM20 and the NAND 10, ensuring of reliability of the NAND memory 10.

FIG. 5 is a diagram of functional blocks formed in the NAND memory 10and the DRAM 20. A write cache (WC) 21 and a read cache (RC) 22configured on the DRAM 20 are interposed between the host 1 and the NANDmemory 10. The WC 21 temporarily stores Write data from the hostapparatus 1. The RC 22 temporarily stores Read data from the NAND memory10. The WC 21 and the RC 22 may be configured on different DRAM chips orother kind of memory chips described above.

The logical blocks in the NAND memory 10 are allocated to respectivemanagement areas of a pre-stage storage area (FS: Front Storage) 12, anintermediate stage storage area (IS: Intermediate Storage) 13, and amain storage area (MS: Main Storage) 11 by the data managing unit 120 inorder to reduce an amount of erasing for the NAND memory 10 duringwriting. The FS 12 manages data from the WC 21 in cluster units, i.e.,“small units” and stores small data (fine grained data) for a shortperiod. The IS 13 manages data overflowing from the FS 12 in clusterunits, i.e., “small units” and stores small data (fine grained data) fora long period. The MS 11 stores data from the WC 21, the FS 12, and theIS 13 in track units, i.e., “large units” and stores large data (coarsegrained data) for a long period. For example, storage capacities are ina relation of MS>IS and FS>WC.

When the small management unit is applied to all the storage areas ofthe NAND memory 10, a size of a management table explained later isenlarged and does not fit in the DRAM 20. Therefore, the respectivestorages of the NAND memory 10 are configured to manage, in smallmanagement units, only data just written recently and small data withlow efficiency of writing in the NAND memory 10. The techniques usingthe “small units” together with the “large units” in the SSD 100 aredescribed in the International Application No. PCT2008/JP/073950, theentire contents of which are incorporated herein by reference.

FIG. 6 is a more detailed functional block diagram related to writeprocessing from the WC 21 to the NAND memory 10. An FS input buffer(FSIB) 12 a that buffers data from the WC 21 is provided at a pre-stageof the FS 12. An MS input buffer (MSIB) 11 a that buffers data from theWC 21, the FS 12, or the IS 13 is provided at a pre-stage of the MS 11.A track pre-stage storage area (TFS) 11 b is provided in the MS 11. TheTFS 11 b is a buffer that has the FIFO (First in First out) structureinterposed between the MSIB 11 a and the MS 11. Data recorded in the TFS11 b is data with an update frequency higher than that of data recordedin the MS 11. Any of the logical blocks in the NAND memory 10 isallocated to the MS 11, the MSIB 11 a, the TFS 11 b, the FS 12, the FSIB12 a, and the IS 13.

Specific functional configurations of the respective components shown inFIGS. 5 and 6 are explained in detail. When the host apparatus 1performs Read or Write for the SSD 100, the host apparatus 1 inputs LBA(Logical Block Addressing) as a logical address via the ATA interface.As shown in FIG. 7, the LBA is a logical address in which serial numbersfrom 0 are attached to sectors (size: 512 B). In this embodiment, asmanagement units for the WC 21, the RC 22, the FS 12, the IS 13, and theMS 11, which are the components shown in FIG. 5, a logical clusteraddress formed of a bit string equal to or higher in order than alow-order (l−k+1)th bit of the LBA and a logical track address formed ofbit strings equal to or higher in order than a low-order (l−i+1)th bitof the LBA are defined. One cluster=2^((l−k)) sectors and onetrack=2^((k−i)) clusters. Read cache (RC) 22

The RC 22 is explained. The RC 22 is an area for temporarily storing, inresponse to a Read request from the ATA-command processing unit 121,Read data from the NAND memory 10 (the FS 12, the IS 13, and the MS 11).In this embodiment, the RC 22 is managed in, for example, anm-line/n-way (m is a natural number equal to or larger than 2^((k−i))and n is a natural number equal to or larger than 2) set associativesystem and can store data for one cluster in one entry. A line isdetermined by LSB (k−i) bits of the logical cluster address. The RC 22can be managed in a full-associative system or can be managed in asimple FIFO system.

Write Cache (WC) 21

The WC 21 is explained. The WC 21 is an area for temporarily storing, inresponse to a Write request from the ATA-command processing unit 121,Write data from the host apparatus 1. The WC 21 is managed in them-line/n-way (m is a natural number equal to or larger than 2^((k−i))and n is a natural number equal to or larger than 2) set associativesystem and can store data for one cluster in one entry. A line isdetermined by LSB (k−i) bits of the logical cluster address. Forexample, a writable way is searched in order from a way 1 to a way n.Tracks registered in the WC 21 are managed in LRU (Least Recently Used)by the FIFO structure of a WC track management table 24 explained latersuch that the order of earliest update is known. The WC 21 can bemanaged by the full-associative system. The WC 21 can be different fromthe RC 22 in the number of lines and the number of ways.

Data written according to the Write request is once stored on the WC 21.A method of determining data to be flushed from the WC 21 to the NAND 10complies with rules explained below.

(i) When a writable way in a line determined by a tag is a last (in thisembodiment, nth) free way, i.e., when the last free way is used, a trackupdated earliest based on an LRU among tracks registered in the line isdecided to be flushed.

(ii) When the number of different tracks registered in the WC 21 exceedsa predetermined permissible number, tracks with the numbers of clusterssmaller than a predetermined number in a WC are decided to be flushed inorder of LRUs.

Tracks to be flushed are determined according to the policies explainedabove. In flushing the tracks, all data included in an identical trackis flushed. When an amount of data to be flushed exceeds, for example,50% of a track size, the data is flushed to the MS 11. When an amount ofdata to be flushed does not exceed, for example, 50% of a track size,the data is flushed to the FS 12.

When track flush is performed under the condition (i) and the data isflushed to the MS 11, a track satisfying a condition that an amount ofdata to be flushed exceeds 50% of a track size among the tracks in theWC 21 is selected and added to flush candidates according to the policy(i) until the number of tracks to be flushed reaches 2^(i) (when thenumber of tracks is equal to or larger than 2^(i) from the beginning,until the number of tracks reaches 2^(i+1)). In other words, when thenumber of tracks to be flushed is smaller than 2^(i), tracks havingvalid clusters more than 2^((k−i−1)) are selected in order from theoldest track in the WC and added to the flush candidates until thenumber of tracks reaches 2^(i).

When track flush is performed under the condition (i) and the track isflushed to the FS 12, a track satisfying the condition that an amount ofdata to be flushed does not exceed 50% of a track size is selected inorder of LRUs among the tracks in the WC 21 and clusters of the trackare added to the flush candidates until the number of clusters to beflushed reaches 2^(k). In other words, clusters are extracted fromtracks having 2^((k−i−1)) or less valid clusters by tracing the tracksin the WC in order from the oldest one and, when the number of validclusters reaches 2^(k), the clusters are flushed to the FSIB 12 a inlogical block units. However, when 2^(k) valid clusters are not found,clusters are flushed to the FSIB 12 a in logical page units. A thresholdof the number of valid clusters for determining whether the flush to theFS 12 is performed in logical block units or logical page units is notlimited to a value for one logical block, i.e., 2^(k) and can be a valueslightly smaller than the value for one logical block.

In a Cache Flush request from the ATA-command processing unit 121, allcontents of the WC 21 are flushed to the FS 12 or the MS 11 underconditions same as the above (when an amount of data to be flushedexceeds 50% of a track size, the data is flushed to the MS 11 and, whenthe amount of data does not exceed 50%, the data is flushed to the FS12).

Pre-Stage Storage Area (FS) 12

The FS 12 is explained. The FS 12 adapts an FIFO structure of logicalblock units in which data is managed in cluster units. The FS 12 is abuffer for regarding that data passing through the FS 12 has an updatefrequency higher than that of the IS 13 at the post stage. In otherwords, in the FIFO structure of the FS 12, a valid cluster (a latestcluster) passing through the FIFO is invalidated when rewriting in thesame address from the host is performed. Therefore, the cluster passingthrough the FS 12 can be regarded as having an update frequency higherthan that of a cluster flushed from the FS 12 to the IS 13 or the MS 11.

By providing the FS 12, likelihood of mixing of data with a high updatefrequency in compaction processing in the IS 13 at the post stage isreduced. When the number of valid clusters of a logical block is reducedto 0 by the invalidation, the logical block is released and allocated tothe free block FB. When the logical block in the FS 12 is invalidated, anew free block FB is acquired and allocated to the FS 12.

When cluster flush from the WC 21 to the FS 12 is performed, the clusteris written in a logical block allocated to the FSIB 12 a. When logicalblocks, for which writing of all logical pages is completed, are presentin the FSIB 12 a, the logical blocks are moved from the FSIB 12 a to theFS 12 by CIB processing explained later. In moving the logical blocksfrom the FSIB 12 a to the FS 12, when the number of logical blocks ofthe FS 12 exceeds a predetermined upper limit value allowed for the FS12, an oldest logical block is flushed from the FS 12 to the IS 13 orthe MS 11. For example, a track with a ratio of valid clusters in thetrack equal to or larger than 50% is written in the MS 11 (the TFS 11 b)and a logical block in which the valid cluster remains is moved to theIS 13.

As the data movement between components in the NAND memory 10, there aretwo ways, i.e., Move and Copy. Move is a method of simply performingrelocation of a pointer of a management table explained later and notperforming actual rewriting of data. Copy is a method of actuallyrewriting data stored in one component to the other component in pageunits, track units, or block units.

Intermediate Stage Storage Area (IS) 13

The IS 13 is explained. In the IS 13, management of data is performed incluster units in the same manner as the FS 12. Data stored in the IS 13can be regarded as data with a low update frequency. When movement(Move) of a logical block from the FS 12 to the IS 13, i.e., flush ofthe logical block from the FS 12 is performed, a logical block as anflush object, which is previously a management object of the FS 12, ischanged to a management object of the IS 13 by the relocation of thepointer. According to the movement of the logical block from the FS 12to the IS 13, when the number of blocks of the IS 13 exceeds apredetermined upper limit value allowed for the IS 13, i.e., when thenumber of writable free blocks FB in the IS decreases to be smaller thana threshold, data flush from the IS 13 to the MS 11 and compactionprocessing are executed. The number of blocks of the IS 13 is returnedto a specified value.

The IS 13 executes flush processing and compaction processing explainedbelow using the number of valid clusters in a track.

Tracks are sorted in order of the number of valid clusters×valid clustercoefficient (the number weighted according to whether a track is presentin a logical block in which an invalid track is present in the MS 11;the number is larger when the invalid track is present than when theinvalid track is not present). 2^(i+1) tracks (for two logical blocks)with a large value of a product are collected, increased to be naturalnumber times as large as a logical block size, and flushed to the MSIB11 a.

When a total number of valid clusters of two logical blocks with asmallest number of valid clusters is, for example, equal to or largerthan 2^(k) (for one logical block), which is a predetermined set value,the step explained above is repeated (to perform the step until a freeblock FB can be created from two logical blocks in the IS).

2^(k) clusters are collected in order from logical blocks with asmallest number of valid clusters and compaction is performed in the IS.

Here, the two logical blocks with the smallest number of valid clustersare selected. However, the number is not limited to two and only has tobe a number equal to or larger than two. The predetermined set valueonly has to be equal to or smaller than the number of clusters that canbe stored in the number of logical blocks smaller than the number ofselected logical blocks by one.

Main Storage Area (MS) 11

The MS 11 is explained. In the MS 11, management of data is performed intrack units. Data stored in the MS 11 can be regarded as having a lowupdate frequency. When Copy or Move of track from the WC 21, the FS 12,or the IS 13 to the MS 11 is performed, the track is written in alogical block allocated to the MSIB 11 a. On the other hand, when onlydata (clusters) in a part of the track is written from the WC 21, the FS12, or the IS 13, track padding explained later for merging existingtrack in the MS 11 and flushed data to create new track and, then,writing the created track in the MSIB 11 a is performed. When invalidtracks are accumulated in the MS 11 and the number of logical blocksallocated to the MS 11 exceeds the upper limit of the number of blocksallowed for the MS 11, compaction processing is performed to create afree block FB.

As the compaction processing of the MS 11, for example, a methodexplained below with attention paid to only the number of valid tracksin a logical block is carried out.

Logical blocks are selected from one with a smallest number of validtracks until a free block FB can be created by combining invalid tracks.

Compaction is executed for tracks stored in the selected logical blocks.The compaction involves passive merge explained later for collectingclusters in the WC 21, the FS 12, and the IS 13 and merging with thetracks stored in the selected logical blocks.

A logical block in which 2^(i) tracks can be integrated is output to theTFS 11 b (2^(i) track MS compaction) and tracks smaller in number than2^(i) are output to the MSIB 11 a (less than 2^(i) track compaction) tocreate a larger number of free blocks FB.

The TFS 11 b adapts an FIFO structure of logical block units in whichdata is managed in track units. The TFS 11 b is a buffer for regardingthat data passing through the TFS 11 b has an update frequency higherthan that of the MS 11 at the post stage. In other words, in the FIFOstructure of the TFS 11 b, a valid track (a latest track) passingthrough the FIFO is invalidated when rewriting in the same address fromthe host is performed. Therefore, a track passing through the TFS 11 bcan be regarded as having an update frequency higher than that of atrack flushed from the TFS 11 b to the MS 11.

FIG. 8 is a diagram of a management table for the data managing unit 120to control and manage the respective components shown in FIGS. 5 and 6.The data managing unit 120 has, as explained above, the function ofbridging the ATA-command processing unit 121 and the NAND memory 10 andincludes a DRAM-layer managing unit 120 a that performs management ofdata stored in the DRAM 20, a logical-NAND-layer managing unit 120 bthat performs management of data stored in the NAND memory 10, and aphysical-NAND-layer managing unit 120 c that manages the NAND memory 10as a physical storage device. An RC cluster management table 23, a WCtrack management table 24, and a WC cluster management table 25 arecontrolled by the DRAM-layer managing unit 120 a. A track managementtable 30, an FS/IS management table 40, an MS logical block managementtable 35, an FS/IS logical block management table 42, and an intra-FS/IScluster management table 44 are managed by the logical-NAND-layermanaging unit 120 b. A logical-to-physical translation table 50 ismanaged by the physical-NAND-layer managing unit 120 c.

The RC 22 is managed by the RC cluster management table 23, which is areverse lookup table. In the reverse lookup table, from a position of astorage device, a logical address stored in the position can besearched. The WC 21 is managed by the WC cluster management table 25,which is a reverse lookup table, and the WC track management table 24,which is a forward lookup table. In the forward lookup table, from alogical address, a position of a storage device in which datacorresponding to the logical address is present can be searched.

Logical addresses of the FS 12 (the FSIB 12 a), the IS 13, and the MS 11(the TFS 11 b and the MSIB 11 a) in the NAND memory 10 are managed bythe track management table 30, the FS/IS management table 40, the MSlogical block management table 35, the FS/IS logical block managementtable 42, and the intra-FS/IS cluster management table 44. In the FS 12(the FSIB 12 a), the IS 13, and the MS 11 (the TFS 11 b and MSIB 11 a)in the NAND memory 10, conversion of a logical address and a physicaladdress is performed of the logical-to-physical translation table 50.These management tables are stored in an area on the NAND memory 10 andread onto the DRAM 20 from the NAND memory 10 during initialization ofthe SSD 100.

RC Cluster Management Table 23 (Reverse Lookup)

The RC cluster management table 23 is explained with reference to FIG.9. As explained above, the RC 22 is managed in the n-way set associativesystem indexed by logical cluster address LSB (k−i) bits. The RC clustermanagement table 23 is a table for managing tags of respective entriesof the RC (the cluster size×m-line×n-way) 22. Each of the tags includesa state flag 23 a including a plurality of bits and a logical trackaddress 23 b. The state flag 23 a includes, besides a valid bitindicating whether the entry may be used (valid/invalid), for example, abit indicating whether the entry is on a wait for readout from the NANDmemory 10 and a bit indicating whether the entry is on a wait forreadout to the ATA-command processing unit 121. The RC clustermanagement table 23 functions as a reverse lookup table for searchingfor a logical track address coinciding with LBA from a tag storageposition on the DRAM 20.

WC Cluster Management Table 25 (Reverse Lookup)

The WC cluster management table 25 is explained with reference to FIG.10. As explained above, the WC 21 is managed in the n-way setassociative system indexed by logical cluster address LSB (k−i) bits.The WC cluster management table 25 is a table for managing tags ofrespective entries of the WC (the cluster size×m-line×n-way) 21. Each ofthe tags includes a state flag 25 a of a plurality of bits, a sectorposition bitmap 25 b, and a logical track address 25 c.

The state flag 25 a includes, besides a valid bit indicating whether theentry may be used (valid/invalid), for example, a bit indicating whetherthe entry is on a wait for flush to the NAND memory 10 and a bitindicating whether the entry is on a wait for writing from theATA-command processing unit 121. The sector position bitmap 25 bindicates which of 2^((l−k)) sectors included in one cluster storesvalid data by expanding the sectors into 2^((l−k)) bits. With the sectorposition bitmap 25 b, management in sector units same as the LBA can beperformed in the WC 21. The WC cluster management table 25 functions asa reverse lookup table for searching for a logical track addresscoinciding with the LBA from a tag storage position on the DRAM 20.

WC Track Management Table 24 (Forward Lookup)

The WC track management table 24 is explained with reference to FIG. 11.The WC track management table 24 is a table for managing information inwhich clusters stored on the WC 21 are collected in track units andrepresents the order (LRU) of registration in the WC 21 among the tracksusing the linked list structure having an FIFO-like function. The LRUcan be represented by the order updated last in the WC 21. An entry ofeach list includes a logical track address 24 a, the number of validclusters 24 b in the WC 21 included in the logical track address, away-line bitmap 24 c, and a next pointer 24 d indicating a pointer tothe next entry. The WC track management table 24 functions as a forwardlookup table because required information is obtained from the logicaltrack address 24 a.

The way-line bitmap 24 c is map information indicating in which of m×nentries in the WC 21 a valid cluster included in the logical trackaddress in the WC 21 is stored. The Valid bit is “1” in an entry inwhich the valid cluster is stored. The way-line bitmap 24 c includes,for example, (one bit (valid)+log₂n bits (n-way))×m bits (m-line). TheWC track management table 24 has the linked list structure. Onlyinformation concerning the logical track address present in the WC 21 isentered.

Track Management Table 30 (Forward Lookup)

The track management table 30 is explained with reference to FIG. 12.The track management table 30 is a table for managing a logical dataposition on the MS 11 in logical track address units. When data isstored in the FS 12 or the IS 13 in cluster units, the track managementtable 30 stores basic information concerning the data and a pointer todetailed information. The track management table 30 is configured in anarray format having a logical track address 30 a as an index. Each entryhaving the logical track address 30 a as an index includes informationsuch as a cluster bitmap 30 b, a logical block ID 30 c+an intra-logicalblock track position 30 d, a cluster table pointer 30 e, the number ofFS clusters 30 f, and the number of IS clusters 30 g. The trackmanagement table 30 functions as a forward lookup table because, using alogical track address as an index, required information such as alogical block ID (corresponding to a storage device position) in whichtrack corresponding to the logical track address is stored.

The cluster bitmap 30 b is a bitmap obtained by dividing 2^((k−i))clusters belonging to one logical track address range into, for example,eight in ascending order of logical cluster addresses. Each of eightbits indicates whether clusters corresponding to 2^((k−i−3)) clusteraddresses are present in the MS 11 or present in the FS 12 or the IS 13.When the bit is “0”, this indicates that the clusters as search objectsare surely present in the MS 11. When the bit is “1”, this indicatesthat the clusters are likely to be present in the FS 12 or the IS 13.

The logical block ID 30 c is information for identifying a logical blockID in which track corresponding to the logical track address is stored.The intra-logical block track position 30 d indicates a storage positionof a track corresponding to the logical track address (30 a) in thelogical block designated by the logical block ID 30 c. Because onelogical block includes maximum 2^(i) valid tracks, the intra-logicalblock track position 30 d identifies 2^(i) track positions using i bits.

The cluster table pointer 30 e is a pointer to a top entry of each listof the FS/IS management table 40 having the linked list structure. Inthe search through the cluster bitmap 30 b, when it is indicated thatthe cluster is likely to be present in the FS 12 or the IS 13, searchthrough the FS/IS management table 40 is executed by using the clustertable pointer 30 e. The number of FS clusters 30 f indicates the numberof valid clusters present in the FS 12. The number of IS clusters 30 gindicates the number of valid clusters present in the IS 13.

FS/IS Management Table 40 (Forward Lookup)

The FS/IS management table 40 is explained with reference to FIG. 13.The FS/IS management table 40 is a table for managing a position of datastored in the FS 12 (including the FSIB 12 a) or the IS 13 in logicalcluster addresses. As shown in FIG. 13, the FS/IS management table 40 isformed in an independent linked list format for each logical trackaddress. As explained above, a pointer to a top entry of each list isstored in a field of the cluster table pointer 30 e of the trackmanagement table 30. In FIG. 13, linked lists for two logical trackaddresses are shown. Each entry includes a logical cluster address 40 a,a logical block ID 40 b, an intra-logical block cluster position 40 c,an FS/IS block ID 40 d, and a next pointer 40 e. The FS/IS managementtable 40 functions as a forward lookup table because requiredinformation such as the logical block ID 40 b and the intra-logicalblock cluster position 40 c (corresponding to a storage device position)in which cluster corresponding to the logical cluster address 40 a isstored is obtained from the logical cluster address 40 a.

The logical block ID 40 b is information for identifying a logical blockID in which cluster corresponding to the logical cluster address 40 a isstored. The intra-logical block cluster position 40 c indicates astorage position of a cluster corresponding to the logical clusteraddress 40 a in a logical block designated by the logical block ID 40 b.Because one logical block includes maximum 2^(k) valid clusters, theintra-logical block cluster position 40 c identifies 2^(k) positionsusing k bits. An FS/IS block ID, which is an index of the FS/IS logicalblock management table 42 explained later, is registered in the FS/ISblock ID 40 d. The FS/IS block ID 40 d is information for identifying alogical block belonging to the FS 12 or the IS 13. The FS/IS block ID 40d in the FS/IS management table 40 is registered for link to the FS/ISlogical block management table 42 explained later. The next pointer 40 eindicates a pointer to the next entry in the same list linked for eachlogical track address.

MS Logical Block Management Table 35 (Reverse Lookup)

The MS logical block management table 35 is explained with reference toFIG. 14. The MS logical block management table 35 is a table forunitarily managing information concerning a logical block used in the MS11 (e.g., which track is stored and whether a track position isadditionally recordable). In the MS logical block management table 35,information concerning logical blocks belonging to the FS 12 (includingthe FSIB 12) and the IS 13 is also registered. The MS logical blockmanagement table 35 is formed in an array format having a logical blockID 35 a as an index. The number of entries can be 32 K entries at themaximum in the case of the 128 GB NAND memory 10. Each of the entriesincludes a track management pointer 35 b for 2^(i) tracks, the number ofvalid tracks 35 c, a writable top track 35 d, and a valid flag 35 e. TheMS logical block management table 35 functions as a reverse lookup tablebecause required information such as a logical track address stored inthe logical block is obtained from the logical block ID 35 acorresponding to a storage device position.

The track management pointer 35 b stores a logical track addresscorresponding to each of 2^(i) track positions in the logical blockdesignated by the logical block ID 35 a. It is possible to searchthrough the track management table 30 having the logical track addressas an index using the logical track address. The number of valid tracks35 c indicates the number of valid tracks (maximum 2^(i)) among tracksstored in the logical block designated by the logical block ID 35 a. Thewritable top track position 35 d indicates a top position (0 to 2^(i−1),2^(i) when additional recording is finished) additionally recordablewhen the logical block designated by the logical block ID 35 a is ablock being additionally recorded. The valid flag 35 e is “1” when thelogical block entry is managed as the MS 11 (including the MSIB 11 a).Here, “additional recording” means that writing cluster or track, inappending manner, to empty logical pages in a logical block.

FS/IS Logical Block Management Table 42 (Reverse Lookup)

The FS/IS logical block management table 42 is explained with referenceto FIG. 15. The FS/IS logical block management table 42 is formed in anarray format having an FS/IS block ID 42 a as an index. The FS/ISlogical block management table 42 is a table for managing informationconcerning a logical block used as the FS 12 or the IS 13(correspondence to a logical block ID, an index to the intra-FS/IScluster management table 44, whether the logical block is additionallyrecordable, etc.). The FS/IS logical block management table 42 isaccessed by mainly using the FS/IS block ID 40 d in the FS/IS managementtable 40. Each entry includes a logical block ID 42 b, an intra-blockcluster table 42 c, the number of valid clusters 42 d, a writable toppage 42 e, and a valid flag 42 f. The MS logical block management table35 functions as a reverse lookup table because required information suchas cluster stored in the logical block is obtained from the FS/IS blockID 42 corresponding to a storage device position.

Logical block IDs corresponding to logical blocks belonging to the FS 12(including the FSIB 12) and the IS 13 among logical blocks registered inthe MS logical block management table 35 are registered in the logicalblock ID 42 b. An index to the intra-FS/IS cluster management table 44explained later indicating a logical cluster designated by which logicalcluster address is registered in each cluster position in a logicalblock is registered in the intra-block cluster table 42 c. The number ofvalid clusters 42 d indicates the number of (maximum 2^(k)) validclusters among clusters stored in the logical block designated by theFS/IS block ID 42 a. The writable top page position 42 e indicates a toppage position (0 to 2^(j−1), 2^(i) when additional recording isfinished) additionally recordable when the logical block designated bythe FS/IS block ID 42 a is a block being additionally recorded. Thevalid flag 42 f is “1” when the logical block entry is managed as the FS12 (including the FSIB 12) or the IS 13.

Intra-FS/IS Cluster Management Table 44 (Reverse Lookup)

The intra-FS/IS cluster management table 44 is explained with referenceto FIG. 16. The intra-FS/IS cluster management table 44 is a tableindicating which cluster is recorded in each cluster position in alogical block used as the FS 12 or the IS 13. The intra-FS/IS clustermanagement table 44 has 2^(j) pages×2^((k−j)) clusters=2^(k) entries perone logical block. Information corresponding to 0th to 2^(k)−1th clusterpositions among cluster positions in the logical block is arranged incontinuous areas. Tables including the 2^(k) pieces of information arestored by the number equivalent to the number of logical blocks (P)belonging to the FS 12 and the IS 13. The intra-block cluster table 42 cof the FS/IS logical block management table 42 is positional information(a pointer) for the P tables. A position of each entry 44 a arranged inthe continuous areas indicates a cluster position in one logical block.As content of the entry 44 a, a pointer to a list including a logicalcluster address managed by the FS/IS management table 40 is registeredsuch that it is possible to identify which cluster is stored in thecluster position. In other words, the entry 44 a does not indicate thetop of a linked list. A pointer to one list including the logicalcluster address in the linked list is registered in the entry 44 a.

Logical-to-Physical Translation Table 50 (Forward Lookup)

The logical-to-physical translation table 50 is explained with referenceto FIG. 17. The logical-to-physical translation table 50 is formed in anarray format having a logical block ID 50 a as an index. The number ofentries can be maximum 32 K entries in the case of the 128 GB NANDmemory 10. The logical-to-physical translation table 50 is a table formanaging information concerning conversion between a logical block IDand a physical block ID and the life. Each of the entries includes aphysical block address 50 b, the number of times of erasing 50 c, andthe number of times of readout 50 d. The logical-to-physical translationtable 50 functions as a forward lookup table because requiredinformation such as a physical block ID (a physical block address) isobtained from a logical block ID.

The physical block address 50 b indicates eight physical block IDs(physical block addresses) belonging to one logical block ID 50 a. Thenumber of times of erasing 50 c indicates the number of times of erasingof the logical block ID. A bad block (BB) is managed in physical block(512 KB) units. However, the number of times of erasing is managed inone logical block (4 MB) units in the 32-bit double speed mode. Thenumber of times of readout 50 d indicates the number of times of readoutof the logical block ID. The number of times of erasing 50 c can be usedin, for example, wear leveling processing for leveling the number oftimes of rewriting of a NAND-type flash memory. The number of times ofreadout 50 d can be used in refresh processing for rewriting data storedin a physical block having deteriorated retention properties.

An example of the wear leveling processing is described in theInternational Application No. PCT/JP2008/066508 and No.PCT/JP2008/066507. An example of the refresh processing is described inthe International Application No. PCT/JP2008/067597, the entire contentsof which are incorporated herein by reference.

The management tables shown in FIG. 8 are collated by management objectas explained below.

RC management: The RC cluster management table 23

WC management: The WC cluster management table 25 and the WC trackmanagement table 24

MS management: The track management table 30 and the MS logical blockmanagement table 35

FS/IS management: The track management table 30, the FS/IS managementtable 40, the MS logical block management table 35, the FS/IS logicalblock management table 42, and the intra-FS/IS cluster management table44

The structure of an MS area including the MS 11, the MSIB 11 a, and theTFS 11 b is managed in an MS structure management table (not shown).Specifically, logical blocks and the like allocated to the MS 11, theMSIB 11 a, and the TFS 11 b are managed. The structure of an FS/IS areaincluding the FS 12, the FSIB 12 a, and the IS 13 is managed in an FS/ISstructure management table (not shown). Specifically, logical blocks andthe like allocated to the FS 12, the FSIB 12 a, and the IS 13 aremanaged.

Read Processing

Read processing is explained with reference to a flowchart shown in FIG.18. When a Read command, LBA as a readout address, and a readout sizeare input from the ATA-command processing unit 121, the data managingunit 120 searches through the RC cluster management table 23 shown inFIG. 9 and the WC cluster management table 25 shown in FIG. 10 (stepS100). Specifically, the data managing unit 120 selects linescorresponding to LSB (k−i) bits (see FIG. 7) of a logical clusteraddress of the LBA from the RC cluster management table 23 and the WCcluster management table 25 and compares logical track addresses 23 band 25 c entered in each way of the selected lines with a logical trackaddress of the LBA (step S110). When a way such that a logical trackaddress entered in itself coincides with a logical track address of LBAis present, the data managing unit 120 regards this as cache hit. Thedata managing unit 120 reads out data of the WC 21 or the RC 22corresponding to the hit line and way of the RC cluster management table23 or the WC cluster management table 25 and sends the data to theATA-command processing unit 121 (step S115).

When there is no hit in the RC 22 or the WC 21 (step S110), the datamanaging unit 120 searches in which part of the NAND memory 10 a clusteras a search object is stored. First, the data managing unit 120 searchesthrough the track management table 30 shown in FIG. 12 (step S120). Thetrack management table 30 is indexed by the logical track address 30 a.Therefore, the data managing unit 120 checks only entries of the logicaltrack address 30 a coinciding with the logical track address designatedby the LBA.

The data managing unit 120 selects a corresponding bit from the clusterbitmap 30 b based on a logical cluster address of the LBA desired to bechecked. When the corresponding bit indicates “0”, this means thatlatest data of the cluster is surely present the MS (step S130). In thiscase, the data managing unit 120 obtains logical block ID and a trackposition in which the track is present from the logical block ID 30 cand the intra-logical block track position 30 d in the same entry of thelogical track address 30 a. The data managing unit 120 calculates anoffset from the track position using LSB (k−i) bits of the logicalcluster address of the LBA. Consequently, the data managing unit 120 cancalculate position where cluster corresponding to the logical clusteraddress in the NAND memory 10 is stored. Specifically, thelogical-NAND-layer managing unit 120 b gives the logical block ID 30 cand the intra-logical block position 30 d acquired from the trackmanagement table 30 as explained above and the LSB (k−i) bits of thelogical cluster address of the LBA to the physical-NAND-layer managingunit 120 c.

The physical-NAND-layer managing unit 120 c acquires a physical blockaddress (a physical block ID) corresponding to the logical block ID 30 cfrom the logical-to-physical translation table 50 shown in FIG. 17having the logical block ID as an index (step S160). The data managingunit 120 calculates a track position (a track top position) in theacquired physical block ID from the intra-logical block track position30 d and further calculates, from the LSB (k−i) bits of the logicalcluster address of the LBA, an offset from the calculated track topposition in the physical block ID. Consequently, the data managing unit120 can acquire cluster in the physical block. The data managing unit120 sends the cluster acquired from the MS 11 of the NAND memory 10 tothe ATA-command processing unit 121 via the RC 22 (step S180).

On the other hand, when the corresponding bit indicates “1” in thesearch through the cluster bitmap 30 b based on the logical clusteraddress of the LBA, it is likely that the cluster is stored in the FS 12or the IS 13 (step S130). In this case, the data managing unit 120extracts an entry of the cluster table pointer 30 e among relevantentries of the logical track address 30 a in the track management table30 and sequentially searches through linked lists corresponding to arelevant logical track address of the FS/IS management table 40 usingthis pointer (step S140). Specifically, the data managing unit 120searches for an entry of the logical cluster address 40 a coincidingwith the logical cluster address of the LBA in the linked list of therelevant logical track address. When the coinciding entry of the logicalcluster address 40 a is present (step S150), the data managing unit 120acquires the logical block ID 40 b and the intra-logical block clusterposition 40 c in the coinciding list. In the same manner as explainedabove, the data managing unit 120 acquires the cluster in the physicalblock using the logical-to-physical translation table 50 (steps S160 andS180). Specifically, the data managing unit 120 acquires physical blockaddresses (physical block IDs) corresponding to the acquired logicalblock ID from the logical-to-physical translation table 50 (step S160)and calculates a cluster position of the acquired physical block ID froman intra-logical block cluster position acquired from an entry of theintra-logical block cluster position 40 c. Consequently, the datamanaging unit 120 can acquire the cluster in the physical block. Thedata managing unit 120 sends the cluster acquired from the FS 12 or theIS 13 of the NAND memory 10 to the ATA-command processing unit 121 viathe RC 22 (step S180).

When the cluster as the search object is not present in the searchthrough the FS/IS management table 40 (step S150), the data managingunit 120 searches through the entries of the track management table 30again and decides a position on the MS 11 (step S170).

Write Processing

Write processing is explained with reference to a flowchart shown inFIG. 19. Data written by a Write command is always once stored on the WC21. Thereafter, the data is written in the NAND memory 10 according toconditions. In the write processing, it is likely that flush processingand compaction processing are performed. In this embodiment, the writeprocessing is roughly divided into two stages of write cache flashprocessing (hereinafter, WCF processing) and clean input bufferprocessing (hereinafter, CIB processing). Steps S300 to S320 indicateprocessing from a Write request from the ATA-command processing unit 121to the WCF processing. Step S330 to the last step indicate the CIBprocessing.

The WCF processing is processing for copying data in the WC 21 to theNAND memory 10 (the FSIB 12 a of the FS 12 or the MSIB 11 a of the MS11). A Write request or a Cache Flush request alone from the ATA-commandprocessing unit 121 can be completed only by this processing. This makesit possible to limit a delay in the started processing of the Writerequest of the ATA-command processing unit 121 to, at the maximum, timefor writing in the NAND memory 10 equivalent to a capacity of the WC 21.

The CIB processing includes processing for moving the data in the FSIB12 a written by the WCF processing to the FS 12 and processing formoving the data in the MSIB 11 a written by the WCF processing to the MS11. When the CIB processing is started, it is likely that data movementamong the components (the FS 12, the IS 13, the MS 11, etc.) in the NANDmemory and compaction processing are performed in a chain-reactingmanner. Time required for the overall processing substantially changesaccording to a state.

WCF Processing

First, details of the WCF processing are explained. When a Writecommand, LBA as a writing address, and a writing size is input from theATA-command processing unit 121, the DRAM-layer managing unit 120 asearches through the WC cluster management table 25 shown in FIG. 10(steps S300 and S305). A state of the WC 21 is defined by the state flag25 a (e.g., 3 bits) of the WC cluster management table 25 shown in FIG.10. Most typically, a state of the state flag 25 a transitions in theorder of invalid (usable)→a wait for writing from an ATA→valid(unusable)→a wait for flush to an NAND→invalid (usable). First, a lineat a writing destination is determined from logical cluster address LSB(k−i) bits of the LBA and n ways of the determined line are searched.When the logical track address 25 c same as that of the input LBA isstored in the n ways of the determined lines (step S305), the DRAM-layermanaging unit 120 a secures this entry as an entry for writing clusterbecause the entry is to be overwritten (valid (unusable)→a wait forwriting from an ATA).

The DRAM-layer managing unit 120 a notifies the ATA-command processingunit 121 of a DRAM address corresponding to the entry. When writing bythe ATA-command processing unit 121 is finished, the data managing unit120 changes the state flag 25 a of the entry to valid (unusable) andregisters required data in spaces of the sector position bitmap 25 b andthe logical track address 25 c. The data managing unit 120 updates theWC track management table 24. Specifically, when an LBA address same asthe logical track address 24 a already registered in the lists of the WCtrack management table 24 is input, the data managing unit 120 updatesthe number of WC clusters 24 b and the way-line bitmap 24 c of arelevant list and changes the next pointer 24 d such that the listbecomes a latest list. When an LBA address different from the logicaltrack address 24 a registered in the lists of the WC track managementtable 24 is input, the data managing unit 120 creates a new list havingthe entries of the logical track address 24 a, the number of WC clusters24 b, the way-line bitmap 24 c, and the next pointer 24 d and registersthe list as a latest list. The data managing unit 120 performs the tableupdate explained above to complete the write processing (step S320).

On the other hand, when the logical track address 25 c same as that ofthe input LBA is not stored in the n ways of the determined line, thedata managing unit 120 judges whether flush to the NAND memory 10 isnecessary (step S305). First, the data managing unit 120 judges whethera writable way in the determined line is a last nth way. The writableway is a way having the state flag 25 a of invalid (usable) or a wayhaving the state flag 25 a of valid (unusable) and a wait for flush to aNAND. When the state flag 25 a is a wait for flush to a NAND, this meansthat flush is started and an entry is a wait for the finish of theflush. When the writable way is not the last nth way and the writableway is a way having the state flag 25 a of invalid (usable), the datamanaging unit 120 secures this entry as an entry for cluster writing(invalid (usable)→a wait for writing from an ATA). The data managingunit 120 notifies the ATA-command processing unit 121 of a DRAM addresscorresponding to the entry and causes the ATA-command processing unit121 to execute writing. In the same manner as explained above, the datamanaging unit 120 updates the WC cluster management table 25 and the WCtrack management table 24 (step S320).

When the writable way is not the last nth way and when the writable wayis the way having the state flag 25 a of valid (unusable) and a wait forflush to a NAND, the data managing unit 120 secures this entry as anentry for writing cluster (valid (unusable) and a wait for flush to aNAND→valid (unusable) and a wait for flush from a NAND and a wait forwriting from an ATA). When the flush is finished, the data managing unit120 changes the state flag 25 a to a wait for writing from an ATA,notifies the ATA-command processing unit 121 of a DRAM addresscorresponding to the entry, and causes the ATA-command processing unit121 to execute writing. In the same manner as explained above, the datamanaging unit 120 updates the WC cluster management table 25 and the WCtrack management table 24 (step S320).

The processing explained above is performed when flush processing doesnot have to be triggered when a writing request from the ATA-commandprocessing unit 121 is input. On the other hand, processing explainedbelow is performed when flush processing is triggered after a writingrequest is input. At step S305, when the writable way in the determinedline is the last nth way, the data managing unit 120 selects track to beflushed, i.e., an entry in the WC 21 based on the condition explained in(i) of the method of determining data to be flushed from the WC 21 tothe NAND memory 10, i.e.,

(i) when a writable way determined by a tag is a last (in thisembodiment, nth) free way, i.e., when the last free way is to be used,track updated earliest based on an LRU among track registered in theline is decided to be flushed.

When that track to be flushed is determined according to the policyexplained above, as explained above, if all cluster in the WC 21included in an identical logical track address are to be flushed and anamount of cluster to be flushed exceeds 50% of a track size, i.e., ifthe number of valid cluster in the WC is equal to or larger than2^((k−i−1)) in the track decided to be flushed, the DRAM-layer managingunit 120 a performs flush to the MSIB 11 a (step S310). If the amount ofcluster does not exceeds 50% of the track size, i.e., the number ofvalid cluster in the WC is smaller than 2^((k−i−1)) in the track decidedto be flushed, the DRAM-layer managing unit 120 a performs flush to theFSIB 12 a (step S315). Details of the flush from the WC 21 to the MSIB11 a and the flush from the WC 21 to the FSIB 12 a are explained later.The state flag 25 a of the selected flush entry is transitioned fromValid (unusable) to a wait for flush to the NAND memory 10.

This judgment on a flush destination is executed by using the WC trackmanagement table 24. An entry of the number of WC clusters 24 indicatingthe number of valid clusters is registered in the WC track managementtable 24 for each logical track address. The data managing unit 120determines which of the FSIB 12 a and the MSIB 11 a should be set as adestination of flush from the WC 21 referring to the entry of the numberof WC clusters 24 b. All clusters belonging to the logical track addressare registered in a bitmap format in the way-line bitmap 24 c.Therefore, in performing flush, the data managing unit 120 can easilylearn, referring to the way-line bitmap 24 c, a storage position in theWC 21 of each of the cluster that should be flushed.

During the write processing or after the write processing, the datamanaging unit 120 also execute the flush processing to the NAND memory10 in the same manner when the following condition is satisfied:

(ii) the number of tracks registered in the WC 21 exceeds apredetermined number.

WC→MSIB (Copy)

When flush from the WC 21 to the MSIB 11 a is performed according to thejudgment based on the number of valid clusters (the number of validclusters is equal to or larger than 2^((k−i−1))), the data managing unit120 executes a procedure explained below as explained above (step S310).

1. Referring to the WC cluster management table 25 and referring to thesector position bitmaps 25 b in tags corresponding to cluster to beflushed, when all the sector position bitmaps 25 b are not “1”, the datamanaging unit 120 performs intra-track sector padding (track padding)explained later for merging with sector not present in the WC 21 byreading out the missing sector included in the identical logical trackaddress from the MS 11.

2. When the number of tracks decided to be flushed is less than 2^(i),the data managing unit 120 adds tracks decided to be flushed having2^((k−i−1)) or more valid clusters until the number of tracks decided tobe flushed reaches 2^(i) from the oldest one in the WC 21.

3. When there are 2^(i) or more tracks to be copied, the data managingunit 120 performs writing in the MSIB 11 a in logical block units witheach 2^(i) tracks as a set.

4. The data managing unit 120 writes the tracks that cannot form a setof 2^(i) tracks in the MSIB 11 a in track units.

5. The data managing unit 120 invalidates clusters and tracks belongingto the copied tracks among those already present on the FS, the IS, andthe MS after the Copy is finished.

Update processing for the respective management tables involved in theCopy processing from the WC 21 to the MSIB 11 a is explained. The datamanaging unit 120 sets the state flag 25 a in entries corresponding toall clusters in the WC 21 belonging to a flushed track in the WC clustermanagement table 25 Invalid. Thereafter, writing in these entries ispossible. Concerning a list corresponding to the flushed track in the WCtrack management table 24, the data managing unit 120 changes ordeletes, for example, the next pointer 24 d of an immediately precedinglist and invalidates the list.

On the other hand, when track flush from the WC 21 to the MSIB 11 a isperformed, the data managing unit 120 updates the track management table30 and the MS logical block management table 35 according to the trackflush. First, the data managing unit 120 searches for the logical trackaddress 30 a as an index of the track management table 30 to judgewhether the logical track address 30 a corresponding to the flushedtrack is already registered. When the logical track address 30 a isalready registered, the data managing unit 120 updates fields of thecluster bitmap 30 b (because the track is flushed to the MS 11 side, allrelevant bits are set to “0”) of the index and the logical block ID 30c+the intra-logical block track position 30 d. When the logical trackaddress 30 a corresponding to the flushed track is not registered, thedata managing unit 120 registers the cluster bitmap 30 b and the logicalblock ID 30 c+the intra-logical block track position 30 d in an entry ofthe relevant logical track address 30 a. The data managing unit 120updates, according to the change of the track management table 30,entries of the logical block ID 35 a, the track management pointer 35 b,the number of valid tracks 35 c, the writable top track 35 d, and thelike in the MS logical block management table 35 when necessary.

When track writing is performed from other areas (the FS 12 and the IS13) to the MS 11 or when intra-MS track writing by compaction processingin the MS 11 is performed, valid clusters in the WC 21 included in thelogical track address as a writing object may be simultaneously writtenin the MS 11. Such passive merge may be present as writing from the WC21 to the MS 11. When such passive merge is performed, the clusters aredeleted from the WC 21 (invalidated).

WC→FSIB (Copy)

When flush from the WC 21 to the FSIB 12 a is performed according to thejudgment based on the number of valid clusters (the number of validclusters is equal to or larger than 2^((k−i−1))), the data managing unit120 executes a procedure explained below.

1. Referring to the sector position bitmaps 25 b in tags correspondingto clusters to be flushed, when all the sector position bitmaps 25 b arenot “1”, the data managing unit 120 performs intra-cluster sectorpadding (cluster padding) for merging with sector not present in the WC21 by reading out the missing sector included in the identical logicalcluster address from the FS 12, the IS 13, and the MS 11.

2. The data managing unit 120 extracts clusters from a track having onlyless than 2^((k−i−1)) valid clusters tracing tracks in the WC 21 inorder from oldest one and, when the number of valid clusters reaches2^(k), writes all the clusters in the FSIB 12 a in logical block units.

3. When 2^(k) valid clusters are not found, the data managing unit 120writes all track with the number of valid clusters less than 2^((k−i−1))in the FSIB 12 a by the number equivalent to the number of logicalpages.

4. The data managing unit 120 invalidates clusters with same logicalcluster address as the clusters copied among those already present onthe FS 12 and the IS 13 after the Copy is finished.

Update processing for the respective management tables involved in suchCopy processing from the WC 21 to the FSIB 12 a is explained. The datamanaging unit 120 sets the state flag 25 a in entries corresponding toall clusters in the WC 21 belonging to a flushed track in the WC clustermanagement table 25 Invalid. Thereafter, writing in these entries ispossible. Concerning a list corresponding to the flushed track in the WCtrack management table 24, the data managing unit 120 changes ordeletes, for example, the next pointer 24 d of an immediately precedinglist and invalidates the list.

On the other hand, when cluster flush from the WC 21 to the FSIB 12 a isperformed, the data managing unit 120 updates the cluster table pointer30 e, the number of FS clusters 31 f, and the like of the trackmanagement table 30 according to the cluster flush. The data managingunit 120 also updates the logical block ID 40 b, the intra-logical blockcluster position 40 c, and the like of the FS/IS management table 40.Concerning clusters not present in the FS 12 originally, the datamanaging unit 120 adds a list to the linked list of the FS/IS managementtable 40. According to the update, the data managing unit 120 updatesrelevant sections of the MS logical block management table 35, the FS/ISlogical block management table 42, and the intra-FS/IS clustermanagement table 44.

CIB Processing

When the WCF processing explained above is finished, thelogical-NAND-layer managing unit 120 b executes CIB processing includingprocessing for moving the data in the FSIB 12 a written by the WCFprocessing to the FS 12 and processing for moving the data in the MSIB11 a written by the WCF processing to the MS 11. When the CIB processingis started, as explained above, it is likely that data movement amongthe blocks and compaction processing are performed in a chain reactingmanner. Time required for the overall processing substantially changesaccording to a state. In the CIB processing, basically, first, the CIBprocessing in the MS 11 is performed (step S330), subsequently, the CIBprocessing in the FS 12 is performed (step S340), the CIB processing inthe MS 11 is performed again (step S350), the CIB processing in the IS13 is performed (step S360), and, finally, the CIB processing in the MS11 is performed again (step S370). In flush processing from the FS 12 tothe MSIB 11 a, flush processing from the FS 12 to the IS 13, or flushprocessing from the IS 13 to the MSIB 11 a, when a loop occurs in aprocedure, the processing may not be performed in order. The CIBprocessing in the MS 11, the CIB processing in the FS 12, and the CIBprocessing in the IS 13 are separately explained.

CIB Processing in the MS 11

First, the CIB processing in the MS 11 is explained (step S330). Whenmovement of track from the WC 21, the FS 12, and the IS 13 to the MS 11is performed, the track is written in the MSIB 11 a. After thecompletion of writing in the MSIB 11 a, as explained above, the trackmanagement table 30 is updated and the logical block ID 30 c, theintra-block track position 30 d, and the like in which tracks arearranged are changed (Move). When new track is written in the MSIB 11 a,track present in the MS 11 or the TFS 11 b from the beginning isinvalidated. This invalidation processing is realized by invalidating atrack from an entry of a logical block in which old track information isstored in the MS logical block management table 35. Specifically, apointer of a relevant track in a field of the track management pointer35 b in the entry of the MS logical block management table 35 is deletedand the number of valid tracks is decremented by one. When all tracks inone logical block are invalidated by this track invalidation, the validflag 35 e is invalidated. Logical blocks of the MS 11 including invalidtracks are generated by such invalidation or the like. When this isrepeated, efficiency of use of logical blocks may fall to causeinsufficiency in usable logical blocks.

When such a situation occurs and the number of logical blocks allocatedto the MS 11 exceeds the upper limit of the number of logical blocksallowed for the MS 11, the data managing unit 120 performs compactionprocessing to create a free block FB. The free block FB is returned tothe physical-NAND-layer managing unit 120 c. The logical-NAND-layermanaging unit 120 b reduces the number of logical blocks allocated tothe MS 11 and, then, acquires a writable free block FB from thephysical-NAND-layer managing unit 120 c anew. The compaction processingis processing for collecting valid clusters of a logical block as acompaction object in a new logical block or copying valid tracks in thelogical block as the compaction object to other logical blocks to createa free block FB returned to the physical-NAND-layer managing unit 120 cand improve efficiency of use of logical blocks. In performingcompaction, when valid clusters on the WC 21, the FS 12, and the IS 13are present, the data managing unit 120 executes passive merge formerging all the valid clusters included in a logical track address as acompaction object. Logical blocks registered in the TFS 11 b are notincluded in the compaction object.

An example of Move from the MSIB 11 a to the MS 11 or to the TFS 11 band compaction processing with presence of a full logical block in theMSIB 11 a set as a condition is specifically explained. The “full”logical block means the logical block in which all logical pages hasbeen written and additional recording is impossible.

1. Referring to the valid flag 35 e of the MS logical block managementtable 35, when an invalidated logical block is present in the MS 11, thedata managing unit 120 sets the logical block as a free block FB.

2. The data managing unit 120 moves a full logical block in the MSIB 11a to the MS 11. Specifically, the data managing unit 120 updates the MSstructure management table (not shown) explained above and transfers thelogical block from management under the MSIB 11 a to management underthe MS 11.

3. The data managing unit 120 judges whether the number of logicalblocks allocated to the MS 11 exceeds the upper limit of the number oflogical blocks allowed for the MS 11. When the number of logical blocksexceeds the upper limit, the data managing unit 120 executes MScompaction explained below.

4. Referring to a field and the like of the number of valid tracks 35 cof the MS logical block management table 35, the data managing unit 120sorts logical blocks having invalidated tracks among logical blocks notincluded in the TFS 11 b with the number of valid tracks.

5. The data managing unit 120 collects tracks from logical blocks withsmall numbers of valid tracks and carries out compaction. In carryingout compaction, first, the tracks are copied for each of the logicalblocks (2^(i) tracks are copied at a time) to carry out compaction. Whena track as a compaction object has valid clusters in the WC 21, the FS12, and the IS 13, the data managing unit 120 also merges the validclusters.

6. The data managing unit 120 sets the logical block at a compactionsource as a free block FB.

7. When the compaction is performed and one logical block includes thevalid 2^(i) tracks, the data managing unit 120 moves the logical blockto the top of the TFS 11 b.

8. When the free block FB can be created by copying the valid tracks inthe logical block to another logical block, the data managing unit 120additionally records the valid tracks in the number smaller than 2^(i)in the MSIB 11 a in track units.

9. The data managing unit 120 sets the logical block at the compactionsource as the free block FB.

10. When the number of logical blocks allocated to the MS 11 falls belowthe upper limit of the number of logical blocks allowed for the MS 11,the data managing unit 120 finishes the MS compaction processing.

CIB Processing in the FS 12

The CIB processing in the FS 12 is explained (step S340). When fulllogical blocks in which all logical pages are written are created in theFSIB 12 a by cluster writing processing from the WC 21 to the FSIB 12 a,the logical blocks in the FSIB 12 a are moved from the FSIB 12 a to theFS 12. According to the movement, an old logical block is flushed fromthe FS 12 of the FIFO structure configured by a plurality of logicalblocks.

Flush from the FSIB 12 a to the FS 12 and flush from the FS 12 to the MS11 and/or the IS 13 are specifically realized as explained below.

1. Referring to the valid flag 35 e and the like of the FS/IS logicalblock management table 42, when an invalidated logical block is presentin the FS 12, the data managing unit 120 sets the logical block as afree block FB.

2. The data managing unit 120 flushes a full logical block in the FSIB12 a to the FS 12. Specifically, the data managing unit 120 updates theFS/IS structure management table (not shown) and transfers the logicalblock from management under the FSIB 12 a to management under the FS 12.

3. The data managing unit 120 judges whether the number of logicalblocks allocated to the FS 12 exceeds the upper limit of the number oflogical blocks allowed for the FS 12. When the number of logical blocksexceeds the upper limit, the data managing unit 120 executes flushexplained below.

4. The data managing unit 120 determines cluster that should be directlycopied to the MS 11 without being moving to the IS 13 among clusters inan oldest logical block as an flush object (actually, because amanagement unit of the MS 11 is a track, the cluster is determined intrack units)

-   -   (A) The data managing unit 120 scans valid clusters in the        oldest logical block as the flush object in order from the top        of a logical page.    -   (B) The data managing unit 120 finds, referring to a field of        the number of FS clusters 30 f of the track management table 30,        how many valid clusters a track to which the cluster belongs has        in the FS 12.    -   (C) When the number of valid clusters in the track is equal to        or larger than a predetermined threshold (e.g., 50% of 2^(k−1)),        the data managing unit 120 sets the track as a candidate of        flush to the MS 11.

5. The data managing unit 120 writes the track that should be flushed tothe MS 11 in the MSIB 11 a.

6. When valid clusters to be flushed in the track units are left in theoldest logical block, the data managing unit 120 further executes flushto the MSIB 11 a.

7. When valid clusters are present in the logical block as the flushobject even after the processing of 2 to 4 above, the data managing unit120 moves the oldest logical block to the IS 13.

When flush from the FS 12 to the MSIB 11 a is performed, immediatelyafter the flush, the data managing unit 120 executes the CIB processingin the MS 11 (step s350).

CIB Processing in the IS 13

The CIB processing in the IS 13 is explained (step S360). The logicalblock is added to the IS 13 according to the movement from the FS 12 tothe IS 13. However, according to the addition of the logical block, thenumber of logical blocks exceeds an upper limit of the number of logicalblocks that can be managed in the IS 13 formed of a plurality of logicalblocks. When the number of logical blocks exceeds the upper limit, inthe IS 13, the data managing unit 120 performs flush of one to aplurality of logical blocks to the MS 11 and executes IS compaction.Specifically, the data managing unit 120 executes a procedure explainedbelow.

1. The data managing unit 120 sorts tracks included in the IS 13 withthe number of valid clusters in the track×a valid cluster coefficient,collects 2^(i+1) tracks (for two logical blocks) with a large value of aproduct, and flushes the tracks to the MSIB 11 a.

2. When a total number of valid clusters of 2^(i+1) logical blocks witha smallest number of valid clusters is, for example, equal to or largerthan 2^(k) (for one logical block), which is a predetermined set value,the data managing unit 120 repeats the step explained above.

3. After performing the flush, the data managing unit 120 collects 2^(k)clusters in order from a logical block with a smallest number of validclusters and performs compaction in the IS 13.

4. The data managing unit 120 releases a logical block not including avalid cluster among the logical blocks at compaction sources as a freeblock FB.

When flush from the IS 13 to the MSIB 11 a is performed, immediatelyafter the flush, the data managing unit 120 executes the CIB processingin the MS 11 (step S370).

FIG. 20 is a diagram of combinations of inputs and outputs in a flow ofdata among components and indicates what causes the flow of the data asa trigger. Basically, data is written in the FS 12 according to clusterflush from the WC 21. However, when intra-cluster sector padding(cluster padding) is necessary incidentally to flush from the WC 21 tothe FS 12, data from the FS 12, the IS 13, and the MS 11 are merged.

In the WC 21, it is possible to perform management in sector (512 B)units by identifying presence or absence of 2^((l−k)) sectors in arelevant logical cluster address using the sector position bitmap 25 bin the tag of the WC cluster management table 25. On the other hand, amanagement unit of the FS 12 and the IS 13, which are functionalcomponents in the NAND memory 10, is a cluster and a management unit ofthe MS 11 is a track. In this way, a management unit in the NAND memory10 is larger than the sector.

Therefore, in writing data in the NAND memory 10 from the WC 21, whendata with a logical cluster or track address identical with that of thedata to be written is present in the NAND memory 10, it is necessary towrite the data in the NAND memory 10 after merging a sector in thecluster or track to be written in the NAND memory 10 from the WC 21 witha sector in the identical logical cluster address present in the NANDmemory 10.

This processing is the intra-cluster sector padding processing (thecluster padding) and the intra-track sector padding (the track padding)shown in FIG. 20. Unless these kinds of processing are performed,correct data cannot be read out. Therefore, when data is flushed fromthe WC 21 to the FSIB 12 a or the MSIB 11 a, the WC cluster managementtable 25 is referred to and the sector position bitmaps 25 b in tagscorresponding to clusters to be flushed is referred to. When all thesector position bitmaps 25 b are not “1”, the intra-cluster sectorpadding or the intra-track sector padding for merging with a sector inan identical cluster or an identical track included in the NAND memory10 is performed. A work area of the DRAM 20 is used for this processing.A plurality of sectors included in a logical cluster address or alogical track address is merged on the work area of the DRAM 20 and dataimage (cluster image or track image) to be flushed is created. Thecreated data image is written in the MSIB 11 a or written in the FSIB 12a from the work area of the DRAM 20.

In the IS 13, basically, data is written according to block flush fromthe FS 12 (Move) or written according to compaction in the IS 13.

In the MS 11, data can be written from all components, the WC 21, the FS12, the IS 13, the MS 11. When track is written in the MS 11, paddingdue to data of the MS 11 itself can be caused because data can only bewritten in track units (track padding). Further, when the data isflushed from the WC 21, the FS 12, or the IS 13 in track units, inaddition to track padding, fragmented data in other components, the WC21, the FS 12, and the IS 13 are also involved according to passivemerge. Moreover, in the MS 11, data is also written according to the MScompaction.

In the passive merge, when track flush from one of three components ofthe WC 21, the FS 12, or the IS 13 to the MS 11 is performed, validclusters stored in the other two components included in the logicaltrack address range of the flushed track and valid clusters in the MS 11are collected and merged in the work area of the DRAM 20 and written inthe MSIB 11 a from the work area of the DRAM 20 as data for one track.

This embodiment is explained more in detail. FIG. 21 is a diagram of adetailed functional configuration related to the write processing of theNAND memory 10 shown in FIG. 6. Redundant explanation is omitted.

FS Configuration

An FS unit 12Q includes the FS input buffer (FSIB) 12 a and the FS 12.The FS 12 has a capacity for a large number of logical blocks. The FIFOstructure is managed in logical block units. The FSIB 12 a to which dataflushed from the WC 21 is input is provided at a pre-stage of the FS 12.The FSIB 12 a includes an FS full block buffer (FSFB) 12 aa and an FSadditional recording buffer (FS additional recording IB) 12 ab. The FSFB12 aa has a capacity for one to a plurality of logical blocks. The FSIB121 ab also has a capacity for one to a plurality of logical blocks.When the data flushed from the WC 21 is data for one logical block, datacopy in logical block units (block Copy) to the FSFB 12 aa is performed.When the data is not the data for one logical block, data copy inlogical page unit (page Copy) to the FSIB 12 ab is performed.

IS Configuration

An IS unit 13Q includes the IS 13, an IS input buffer (ISIB) 13 a, andan IS compaction buffer 13 c. The ISIB 13 a has a capacity for one to aplurality of logical blocks, the IS compaction buffer 13 c has acapacity for, for example, one logical block, and the IS 13 has acapacity for a large number of logical blocks. In the IS 13, as in theFS 12, the FIFO structure is managed in logical block units. The IScompaction buffer 13 c is a buffer for performing compaction in the ISunit 13Q.

As explained above, the IS unit 13Q performs management of data incluster units in the same manner as the FS unit 12Q. When movement of alogical block from the FS unit 12Q to the IS unit 13Q, i.e., flush fromthe FS 12 is performed, a logical block as an flush object, which is aprevious management object of the FS unit 12Q, is changed to amanagement object of the IS unit 13 (specifically, the ISIB 13 a)according to relocation of a pointer (block Move). When the number oflogical blocks of the IS 13 exceeds a predetermined upper limitaccording to the movement of the logical block from the FS unit 12Q tothe IS unit 13Q, data flush from the IS 13 to an MS unit 11Q and IScompaction processing are executed and the number of logical blocks ofthe IS unit 13Q is returned to a specified value.

MS Configuration

The MS unit 11Q includes the MSIB 11 a, the track pre-stage buffer (TFS)11 b, and the MS 11. The MSIB 11 a includes one to a plurality of (inthis embodiment, four) MS full block input buffers (hereinafter, MSFBs)11 aa and one to a plurality of (in this embodiment, two) additionalrecording input buffers (hereinafter, MS additional recording IBs) 11ab. One MSFB 11 aa has a capacity for one logical block. The MSFB 11 aais used for writing in logical block units. One MS additional recordingIB 11 ab has a capacity for one logical block. The MS additionalrecording IB 11 ab is used for additional writing in track units.

The 2^(i) valid tracks flushed from the WC 21, the 2^(i) valid tracksflushed from the FS 12, or the 2^(i) valid tracks flushed from the IS 13are written in the MSFB 11 aa in logical block units (block Copy). Thelogical block, which functions as the MSFB 11 aa, filled with the 2^(i)valid tracks is directly moved to the MS 11 (block Move) without beingmoved through the TFS 11 b. After the logical block is moved to the MS11, a free block FB is allocated as the MSFB 11 aa anew.

The valid track less than 2^(i) flushed from the WC 21 or the validtrack less than 2^(i) flushed from the FS 12 is written, in appendingmanner, to the MS additional recording IB 11 ab in track units (trackCopy). The logical block, which functions as the MS additional recordingIB 11 ab, filled with the 2^(i) valid tracks is moved to the TFS 11 b(block Move). After the logical block is moved to the TFS 11 b, a freeblock FB is allocated as the MS additional recording IB 11 ab anew.

The TFS 11 b is a buffer that has a capacity for a large number oflogical blocks and adapts an FIFO structure of logical block units inwhich data is managed with track units. The TFS 11 b is interposedbetween the MS additional recording IB 11 ab and the MS 11. The logicalblock, which functions as the MS additional recording IB 11 ab, filledwith the 2^(i) valid tracks is moved to an input side of the TFS 11 bhaving the FIFO structure. Further, one logical block including 2^(i)valid tracks, which functions as the MS compaction buffer 11 c, formedby the compaction processing is moved to the input side of the TFS 11 b(block Move).

The MS compaction buffer 11 c is a buffer for performing compaction inthe MS 11. When a track in the MS is written in the MS compaction buffer11 c according to the compaction processing in the MS 11, passive mergefor writing valid clusters in the WC 21, the FS unit 12Q, and the ISunit 13Q, which are included in the track as a writing object, in the MScompaction buffer 11 c via the work area of the DRAM 20 is performed. Inthis embodiment, logical blocks registered in the MSIB 11 a and the TFS11 b are not included in the compaction object.

FIG. 22 is a diagram of a more detailed functional configuration of thedata managing unit 120. As explained above, the data managing unit 120includes the DRAM-layer managing unit 120 a that performs management ofdata stored in the DRAM 20, the logical-NAND-layer managing unit 120 bthat performs management of data stored in the NAND memory 10, and thephysical-NAND-layer managing unit 120 c that manages the NAND memory 10as a physical storage device.

The DRAM-layer managing unit 120 a includes the RC cluster managementtable 23, the WC cluster management table 25, and the WC trackmanagement table 24 and performs management of a DRAM layer based on themanagement tables. The logical-NAND-layer managing unit 120 b includes,besides the track management table 30, the MS block management table 35,the FS/IS management table 40, the FS/IS logical block management table42, and the intra-FS/IS cluster management table 44, an MS structuremanagement table 60 and an FS/IS structure management table 65 andperforms management of a logical NAND layer of the NAND memory 10 basedon the management tables. The physical-NAND-layer managing unit 120 cincludes, besides the logical-to-physical translation table 50, a badblock management table (BB management table) 200, a reserved blockmanagement table (RB block management table) 210, a free blockmanagement table (FB management table) 220, and an active blockmanagement table (AB management table) 230 and performs management of aphysical NAND layer of the NAND memory 10 using the management tables.

Physical NAND Layer

First, the physical NAND layer is explained. As explained above, in the32-bit double speed mode, four channels (ch0, ch1, ch2, and ch3) areactuated in parallel and erasing, writing, and readout are performed byusing a double speed mode of an NAND memory chip. As shown in FIG. 23,each of NAND memory chips in the four parallel operation elements 10 ato 10 d is divided into, for example, two districts of a plane 0 and aplane 1. The number of division is not limited to two. The plane 0 andthe plane 1 include peripheral circuits independent from one another(e.g., a row decoder, a column decoder, a page buffer, and a data cache)and can simultaneously perform erasing, writing, and readout based on acommand input from the NAND controller 112. In the double speed mode ofthe NAND memory chip, high-speed writing is realized by controlling theplane 0 and the plane 1 in parallel.

A physical block size is 512 kB. Therefore, in the 32-bit double speedmode, an erasing unit of the physical block is increased to 512 kB×4×2=4MB according to the parallel operation of the four channels and thesimultaneous access to the two planes. As a result, in the 32-bit doublespeed mode, eight planes operate in parallel.

FIG. 24 is a diagram of another example of the logical-to-physicaltranslation table 50. In the logical-to-physical translation table 50shown in FIG. 24, a field of erasing time 50 e indicating time when alogical block corresponding to the logical block ID 50 a is erased isadded to the logical-to-physical table 50 shown in FIG. 17. As theerasing time 50 e, for example, a value obtained by measuring the numberof times an erasing operation is applied to the logical blocks in theNAND memory chip or energization time of the NAND controller 112 onlyhas to be used. The erasing time 50 e is used for free block FBmanagement in the FB management table 220 explained later.

The BB management table 200 is a table for managing bad blocks BB inphysical block (512 kB) units. As shown in FIG. 25, the BB managementtable 200 is formed in a two-dimensional array format having, forexample, for every 4 (channels)×2 (planes/channels) intra-channelplanes, information concerning physical blocks for (the number ofphysical blocks/planes)×(the number of NAND memory chips/one paralleloperation element). In each entry of the BB management table 200, aphysical block ID 200 a for each physical block is stored.

In the case of this embodiment, one NAND memory chip has a 2 GB size.Physical block IDs “0” to “2047” are allocated to a plane 0 of a firstchip. Physical block IDs “2048” to “4095” are allocated to a plane 1 ofthe first chip. When the bad block BB generated during use is registeredin the BB management table 200, the physical-NAND-layer managing unit120 c adds bad blocks BB immediately behind last valid entries ofintra-channel plane IDs (ID#0 to ID#7) corresponding thereto withoutsorting the bad blocks BB.

For example, a physical block for which, when a use is allocated to afree block FB, an erasing operation is not normally finished isregistered as the bad block BB, or for which, when data is written in aactive block AB used as the FS 12, IS 13, or MS 11, writing operation isnot normally finished may be registered as the bad block BB.

The RB management table 210 is a table for managing physical blocks(reserved blocks RB) remaining when 4 MB logical blocks are formed ineight physical block units (512 kB). The RB management table 210 ismanaged in a format same as that of the BB management table 200. Bymanaging the blocks in FIFO for each of intra-channel plane IDscorresponding thereto, the reserved blocks RB are preferentially used inorder from one registered earliest.

The FB management table 220 is a table for managing free blocks FBpresently not allocated to a use (e.g., use for the FS12, IS 13, orMS11) in 4 MB logical block units and is a list in the FIFO formatsorted in order of creation of the free blocks FB. A logical block ID isstored in each entry. The free block FB returned to the FB managementtable 220 according to compaction processing or the like is added to thetail end of the list. Free block FB allocation is performed by returninga top block of the list.

As shown in FIG. 26, the FB management table is configured in two stagesof a return FIFO list 220 a and an allocation list 220 b. The returnFIFO list 220 a is aligned in order of the erasing time 50 e. In theallocation list 220 b, a logical block with a smaller number of times oferasing 50 c is located closer to the top of the list. This is aconfiguration for preventing an erasing operation from being repeated atshort time intervals. An unnecessary logical block returned to the FBmanagement table 220 is added to the tail end of the return FIFO list220 a and stored there for a fixed period.

A logical block pushed out from the return FIFO list 220 a is insertedin somewhere in the allocation list 220 b according to the number oftimes of erasing 50 c of the logical block. When allocation of the freeblock FB is requested from the logical-NAND-layer managing unit 120 b,the logical-NAND-layer managing unit 120 c extracts the free block FBfrom the top of the allocation list 220 b and allocates the free blockFB.

With the FB management table, it is possible to equally distributelogical blocks to be erased (wear leveling processing) such that thenumbers of times of erasing and erasing intervals of all logical blocksare generally equal. It is known that the life of a NAND-type flashmemory depends on intervals of erasing processing besides the number oftimes of erasing and, as the intervals are longer, retention propertiesare better and the life is longer. This also indicates that, when theerasing intervals are short, the retention properties are bad and thelife is spoiled. It is also known that, even if writing is performed atshort intervals, unless appropriate long term erasing is performed, theretention properties are recovered.

The AB management table 230 is a list of logical blocks (active blocksAB), to which a use (e.g., use for the FS12, IS 13, or MS11) areallocated, allocated from the free blocks FB. As in the FB managementtable 220, in the AB management table 230, a logical block ID is storedin each entry. A logical block with earlier registration order islocated closer to the top. The AB management table is used for, forexample, refresh processing.

The refresh processing is a technique for preventing an error exceedingerror correction ability of the SSD 110 from occurring because of theinfluence of aged deterioration of written data and read disturb, whichis data breakage involved in read processing. Specifically, for example,before an error exceeding the error correction ability occurs,processing for reading out stored data and performing error correctionand, then, rewriting the data in the NAND-type flash memory isperformed. For example, a block with a large number of times of readout50 d, a top block of the AB management table 230, and the like can beset as monitoring objects of the refresh processing.

The physical-NAND-layer managing unit 120 c performs logicalblock/physical block management explained below. First, a correspondencerelation between a logical block ID and eight physical block IDs in thelogical-to-physical translation table 50 is explained with reference toFIG. 27.

As explained above, eight physical block IDs associated with the logicalblock ID 50 a as an index of the logical-to-physical translation table50 are registered in fields of the physical block ID 50 b of thelogical-to-physical translation table 50. FIG. 27 is a diagram of acorrespondence relation between logical block IDs and physical block IDsof the NAND memory 10. One section represents one physical block. Aphysical block ID is allocated to each of the physical blocks. A logicalblock L0 (active block AB) includes, for example, eight physical blocksin the first row and the third column, the second row and the secondcolumn, the third row and the second column, the fourth row and thesecond column, the fifth row and the second column, the six row and thesecond column, the seventh row and the second column, and the eighth rowand the third column. A logical block L1 (active block AB) surrounded bya broken line BL1 includes, for example, eight physical blocks in thefirst row and a fourth column, the second row and the third column, thethird row and the third column, the fourth row and the third column, thefifth row and the third column, the sixth row and the third column, theseventh row and the third column, and the eighth row and the fourthcolumn.

Thereafter, for example, it is assumed that, when a use is allocated tothe logical block L1 (in this case, the logical block L1 is the freeblock FB) and erasing operation is executed or when data is written inthe logical block L1 used as the FS 12, IS 13, or MS 11 (in this case,the logical block L1 is the active block AB as shown in FIG. 27) andwriting operation is executed, the erasing or writing operation for thephysical block in the fourth row and the third column of the logicalblock L1 is not normally finished, and as a result, the physical blockis registered in the BB management table 200 as the bad block BB thatcannot be used as a storage area.

The physical-NAND-layer managing unit 120 c detects the registration andselects, as a replacement candidate for the bad block BB, thereservation block RB in a channel and a plane identical with those ofthe physical block registered as the bad block BB from the RB managementtable 210.

In the case of FIG. 27, a physical block (the reserved block RB) in thefourth row and the fourth column adjacent to the bad block BB isselected as a replacement candidate for the bad block BB in the fourthrow and the third column.

The physical-NAND-layer managing unit 120 c searches through an entry ofthe logical block ID 50 a corresponding to the logical block L1 of thelogical-to-physical translation table 50 and changes a physical block IDof the bad block BB corresponding to the fourth row and the third columnamong the eight physical block IDs included in a field of the physicalblock ID 50 b in the entry to a physical address ID corresponding to thereserved block RB in the fourth row and the fourth column selected fromthe RB management table 210.

Consequently, thereafter, the logical block L1 includes a combination ofeight new physical blocks in the first row and the fourth column, thesecond row and the third column, the third row and the third column, thefourth row and the fourth column, the fifth row and the third column,the sixth row and the third column, the seventh row and the thirdcolumn, and the eighth row and the fourth row surrounded by an alternatelong and short dash line. It is assumed that a logical block ID of thelogical block L1 is “L1”.

Thereafter, the physical-NAND-layer managing unit 120 c secures a newfree block FB (not shown in FIG. 27) from the FB management table 220.It is assumed that a logical block ID of the secured free block FB is“L2”. The physical-NAND-layer managing unit 120 c executes replacementof the logical block IDs using the logical-to-physical translation table50.

Specifically, the physical-NAND-layer managing unit 120 c associates theeight physical blocks, which are associated with the new free block FBwith the logical block ID “L2”, with the logical block ID “L1”. At thesame time, the physical-NAND-layer managing unit 120 c associates theeight physical blocks in the first row and the fourth column, the secondrow and the third column, the third row and the third column, the fourthrow and the fourth column, the fifth row and the third column, the sixthrow and the third column, the seventh row and the third column, and theeighth row and the fourth column surrounded by the alternate long andshort dash line with the logical block ID “L2”. The number of times oferasing 50 c, the number of times of readout 50 d, and the erasing time50 e are also replaced according to the update of the physical blockIDs. Thereafter, the physical-NAND-layer managing unit 120 c registersthe logical block ID “L2” in the FB management table 220. Thelogical-NAND-layer managing unit 120 b executes erasing or writingoperation in the newly secured logical block with the same logical blockID “L1” afresh.

On the other hand, when the reserved block RB that can be replaced withthe bad block BB is not present, the physical-NAND-layer managing unit120 c performs processing explained below. For example, it is assumedthat the physical block in the fourth row and the third column isregistered in the BB management table 200 as the bad block BB and thereserved block RB is not present in an identical channel and anidentical plane for the bad block BB. In this case, first, thephysical-NAND-layer managing unit 120 c registers the seven physicalblocks in the first row and the fourth column, the second row and thethird column, the third row and the third column, the fifth row and thethird column, the sixth row and the third column, the seventh row andthe third column, and the eighth row and the fourth column excluding thefourth row and the third column in the logical block L1 in the RBmanagement table 210. Thereafter, in the same manner as explained above,the physical-NAND-layer managing unit 120 c secures a new free block FBfrom the FB management table 220 and executes replacement of the logicalblock IDs as explained above, and, then, sets the logical block IDacquired from the FB management table 220 unusable.

In this way, even when the bad block BB is generated, thephysical-NAND-layer managing unit 120 c is executing replacement of thelogical block IDs. Therefore, the logical block ID used in thelogical-NAND-layer managing unit 120 b does not change before and afterthe generation of the bad block BB. Therefore, even when at least one ofa plurality of physical blocks is registered as a bad block, acorrespondence relation between LBA logical addresses and logical blocksis not changed. It is possible to prevent overhead of rewriting of themanagement tables in the logical-NAND-layer managing unit 120 b.

In the 8-bit normal mode for independently driving one plane in theparallel operation elements 10 a to 10 d, an erasing unit of the mode isone physical block (512 KB). The 8-bit normal mode is used when awriting size is small, for example, when a log for recording updatedcontents of the management tables is additionally written.

When the free block FB used in such an 8-bit normal mode, i.e., aphysical block in 512 KB units is necessary, the physical-NAND-layermanaging unit 120 c secures 4 MB logical block in the 32-bit doublespeed mode and selects one physical block in the secured logical block.FIG. 27 indicates that a logical block L3 surrounded by a broken lineBL3 including one physical block surrounded by a thick line, which isused soon in the logical-NAND-layer managing unit 120 b, is assigned.

In the 8-bit normal mode, first, the physical-NAND-layer managing unit120 c uses the selected one physical block. When the one physical blockis filled with data because of the additional recording of the log, thephysical-NAND-layer managing unit 120 c uses another physical blockamong the eight physical blocks in the logical block L3. Thereafter,such processing is repeated.

Erasing processing in the 32-bit double speed mode is explained. Thephysical-NAND-layer managing unit 120 c counts up, every time data inthe NAND memory 10 is erased in logical block units, a field of thenumber of times of erasing 50 c in a logical block ID corresponding toan erased logical block of the logical-to-physical translation table 50shown in FIG. 24 by one and updates the erasing time 50 e to latestdata.

Logical NAND Layer

The MS structure management table 60 and the FS/IS structure managementtable 65 used for management in a logical NAND layer are explained withreference to FIGS. 28 and 29. The MS structure management table 60 shownin FIG. 28 includes an area for managing the structure of the MS unit11Q and an area for storing state information. The MS structuremanagement table 60 includes an MS buffer management table 61 formanaging logical block IDs allocated as the MSFB 11 aa, the MSadditional recording IB 11 ab, and the TFS 11 b, a logical block ID listby the number of valid tracks 62 for storing logical block IDs with asmall number of valid tracks in order to increase the speed of sortprocessing during the MS compaction, and areas 63 and 64 for managing amaximum number of logical blocks MBL and the number of valid logicalblocks VBL as state information.

In the MS structure management table 60, fixed fields 61 a to 61 c witha required number of entries are prepared for the MSFB 11 aa, the MSadditional recording IB 11 ab, and the TFS 11 b. Logical block IDs arerecorded in the fixed fields 61 a to 61 c. The field 61 c for the TFS 11b has the linked list structure. FIFO-like management for the TFS 11 bhaving the FIFO structure is performed.

In the logical block ID list by the number of valid tracks 62, arequired number of entries are prepared for a logical block with onevalid track, a required number of entries are prepared for a logicalblock with two valid tracks, . . . , and a required number of entriesare prepared for a logical block with 2^(i)−1 valid tracks. A logicalblock ID is recorded in each of the entries. When a field of the numberof valid tracks 35 c of the MS logical block management table 35 issearched, the logical block ID list by the number of valid tracks 62 isalways updated to a latest state. Logical blocks registered in the MSbuffer management table 61 as the MSIB 11 a and the TFS 11 b are notentered in the logical block ID list by the number of valid tracks 62.

In the fixed field 63 for the maximum number of logical blocks MBL asstate information, a maximum number of logical blocks MBL as the numberof logical blocks that the MS unit 11Q is allowed to acquire isrecorded. In the fixed field 64 for the number of valid logical blocksVBL as state information, the number of valid logical blocks VBL as thenumber of logical blocks presently managed as the MS unit 11Q isrecorded.

The FS/IS structure management table 65 shown in FIG. 29 has an area formanaging the structure of the FS unit 12Q and the IS unit 13Q. The FS/ISstructure management table 65 includes an FS input buffer managementtable 66 for managing logical block ID allocated as the FSIB 12 a andthe FS additional recording IB 12 ab, an FS FIFO management table 67 formanaging the FIFO structure of the FS 12, an IS input buffer managementtable 68 for managing a logical block ID allocated as the ISIB 13 a, andthe IS FIFO management table 69 for managing the FIFO structure of theIS 13.

In the FS input buffer management table 66, fixed fields 66 a and 66 bwith a required number of entries are prepared for the FSFB 12 aa andthe FS additional recording IB 12 ab. The FS/IS block ID 42 a as anindex of the FS/IS logical block management table 42 is registered inthe fixed fields 66 a and 66 b. In the IS input buffer management table68, fixed fields with a required number of entries are prepared for theISIB 13 a. The FS/IS block ID 42 a is registered in the fixed fields. Inthe FS FIFO management table 67, entries for the number of logicalblocks forming the FIFO structure of the FS 12 are prepared in fixedfields. The FS/IS block ID 42 a is registered in the fixed fields of theFS FIFO management table 67. In the IS FIFO management table 69, entriesfor the number of logical blocks forming the FIFO structure of the IS 13are prepared in fixed fields. The FS/IS block ID 42 a is registered inthe fixed fields.

Update processing for the management tables involved in the Copyprocessing from the WC 21 to the MSIB 11 a in executing the writeprocessing divided into the two stages (the WCF processing and the CIBprocessing) explained with reference to FIG. 19 is explained. Here, Copyin track units from the WC 21 to the MS additional recording IB 11 ab isperformed. The DRAM-layer managing unit 120 a checks the WC trackmanagement table 24 in order from the top, referring to the way-linebitmap 24 c in a track entry in which the logical track address 24 acorresponding to a track decided to be flushed is registered, changesthe state flag 25 a in an entry in the WC cluster management table 25corresponding to an entry with a valid bit “1” in m×n entries of theway-line bitmap 24 c from Valid to a wait for flush to a NAND, andnotifies the logical-NAND-layer managing unit 120 b of an flush request.

On the other hand, the logical-NAND-layer managing unit 120 b checks astate of the MS additional recording IB 11 ab referring to the MS buffermanagement table 61 of the MS structure management table 60 shown inFIG. 28 and the MS logical block management table 35 shown in FIG. 14.When it is judged from the field 61 b for the MS additional recording IBof the MS buffer management table 61 that the MS additional recording IB11 ab is already present, the logical-NAND-layer managing unit 120 bacquires information concerning the number of writable tracks for alogical block ID registered in the field 61 b for the MS additionalrecording IB from the field of the number of valid tracks 35 c of the MSlogical block management table 35 and notifies the DRAM-layer managingunit 120 a of the acquired number of writable tracks.

When it is judged from the field 61 b for the MS additional recording IBof the MS buffer management table 61 that the MS additional recording IB11 ab is not present, the logical-NAND-layer managing unit 120 b issuesa request for acquiring the free block FB to the physical-NAND-layermanaging unit 120 c and acquires the free block FB together with alogical block ID allocated as the free block FB. The logical-NAND-layermanaging unit 120 b notifies the DRAM-layer managing unit 120 a of thenumber of writable tracks 2^(i) of the acquired free block FB.

The DRAM-layer managing unit 120 a selects tracks from the WC trackmanagement table 24 by the number of writable tracks notified from thelogical-NAND-layer managing unit 120 b and judges whether theintra-track sector padding and/or the passive merge needs to beperformed. In order to check whether clusters and/or tracks included inrange of the logical track addresses to be flushed is present in theNAND memory 10 and judges whether the intra-track sector padding and/orthe passive merge needs to be performed, the DRAM-layer managing unit120 a notifies the logical-NAND-layer managing unit 120 b of requiredinformation such as a logical track address to be flushed.

When the logical-NAND-layer managing unit 120 b receives thisnotification, the logical-NAND-layer managing unit 120 b searchesthrough the logical track address 30 a as an index of the trackmanagement table 30 and, when necessary, further searches through theFS/IS management table 40, and judges whether a logical track addressidentical with the logical track address to be flushed is present on theNAND memory 10. The logical-NAND-layer managing unit 120 b notifies thephysical-NAND-layer managing unit 120 c of a result of the search.Consequently, the physical-NAND-layer managing unit 120 c performs flushfrom the WC 21 to the MS additional recording IB 11 ab involving theintra-track sector padding and/or the passive merge or not involving theintra-track sector padding and the passive merge.

When the finish of the flush from the WC 21 to the MS additionalrecording IB 11 ab is notified from the physical-NAND-layer managingunit 120 c, if a new free block FB is acquired from thephysical-NAND-layer managing unit 120 c as the MS additional recordingIB 11 ab, the logical-NAND-layer managing unit 120 b sets the valid flag35 e of an entry of the MS logical block management table 35corresponding to a logical block ID of the free block FB given from thephysical-NAND-layer managing unit 120 c valid, registers the logicalblock ID in the field 61 b for the MS additional recording IB of the MSbuffer management table 61, and increments the number of valid logicalblocks VBL of the MS structure management table 60.

The logical-NAND-layer managing unit 120 b updates the track managementtable 30. In other words, the logical-NAND-layer managing unit 120 bregisters required information such as the cluster bit map 30 b, thelogical block ID 30 c, and the intra-logical block track position 30 din an entry of the logical track address 30 a corresponding to the trackflushed from the WC 21 to the MS additional recording IB 11 ab.

When an old track having the identical logical track address is notpresent in the NAND memory 10 and the intra-track sector padding and thepassive merge is not performed, the logical-NAND-layer managing unit 120b registers required information concerning the new track flushed fromthe WC 21 in an entry corresponding to the logical track address of thetrack management table 30. The logical-NAND-layer managing unit 120 bregisters information concerning the track flushed from the WC 21 in anentry corresponding to a written logical block ID of the MS logicalblock management table 35. As the registration in the MS logical blockmanagement table 35, there are, for example, update of the logical trackaddress (the track management pointer 35 b) as an index of the trackmanagement table 30 corresponding to the tracks stored in the logicalblock allocated to the MS 11, update of the number of valid tracks 35 c,and update of the writable top track 35 d.

When an old track having the identical logical track address is presentin the NAND memory 10 (the old track is superseded) and the intra-tracksector padding and/or the passive merge is performed, thelogical-NAND-layer managing unit 120 b updates required information suchas the logical block ID 30 c and the intra-logical block track position30 d in an entry of the logical track address 30 a corresponding to amerge source track in the track management table 30. Specifically, thelogical-NAND-layer managing unit 120 b changes the logical block ID 30 cfrom an old logical block ID in the MS 11 to which the merge sourcetrack is associated to a new logical block ID corresponding to the MSadditional recording IB 11 ab. The intra-logical block track position 30d is changed according to an additional recording state.

Moreover, the logical-NAND-layer managing unit 120 b deletes a relevantsection of a field of the track management pointer 35 b in an entrycorresponding to the old logical block ID to which the merge sourcetrack is associated in the MS logical block management table 35,decrements the number of valid tracks 35 c, and updates the logicalblock ID list by the number of valid tracks 62 of the MS structuremanagement table 60. When the number of valid tracks 35 c in the entrycorresponding to the old logical block ID to which the merge sourcetrack is associated is reduced to 0 by the decrement, thelogical-NAND-layer managing unit 120 b decrements the number of validlogical blocks VBL of the MS structure management table 60 and returnsthe logical block as the free block FB to the physical-NAND-layermanaging unit 120 c. The logical-NAND-layer managing unit 120 b sets thevalid flag 35 e of the entry corresponding to the released logical blockinvalid. Moreover, in the same manner as explained above, thelogical-NAND-layer managing unit 120 b registers information concerningthe new track flushed from the WC 21 in the MS logical block managementtable 35.

When the completion of flush from the WC 21 to the MS additionalrecording IB 11 ab is notified from the physical-NAND-layer managingunit 120 c, the logical-NAND-layer managing unit 120 b notifies theDRAM-layer managing unit 120 a of the completion of the flush (WCFprocessing). The DRAM-layer managing unit 120 a receives thenotification and sets the state flags 25 a in entries corresponding toall clusters belonging to the flushed track in the WC cluster managementtable 25 invalid (usable). Thereafter, writing of data from the hostapparatus 1 in the entries is possible. Concerning a list correspondingto the flushed track in the WC track management table 24, for example,the next pointer 24 d of an immediately preceding list is changed ordeleted and the list is invalidated.

The CIB processing is explained. When the WCF processing is finished,the CIB processing including processing for moving the data of the FSIB12 a written by the WCF processing to the FS 12 and processing formoving the data of the MSIB 11 a written by the WCF processing to the MS11 or the TFS 11 b is executed. A detailed procedure of the CIBprocessing is explained below with reference to a flowchart shown inFIG. 30.

CIB Processing in the MS Unit 11Q

First, the CIB processing in the first time in the MS unit 11Q explainedat step S330 in FIG. 19 is explained in detail. The logical-NAND-layermanaging unit 120 b acquires, from a field of the number of valid tracks35 c of the MS logical block management table 35, information of thenumber of valid tracks concerning logical block IDs registered in thefield 61 a for the MSFB and the field 61 b for the MS additionalrecording IB of the MS buffer management table 61 of the MS structuremanagement table 60. The logical-NAND-layer managing unit 120 b checkswhether one or more full blocks, in which all logical pages are writtenwith tracks, are present in the MSFB 11 aa or the MS additionalrecording IB 11 ab of the MSIB 11 a (step S400). When one or more fullblocks are present in the MSIB 11 a, the logical-NAND-layer managingunit 120 b performs the processing explained below. When the judgment atstep S400 is NO, the procedure shifts to step S440.

When the judgment at step S400 is YES, the logical-NAND-layer managingunit 120 b checks whether an invalid logical block, the number of validtracks 35 c of which is 0, is present in the MS referring to the numberof valid tracks 35 c of the MS logical block management table 35. Whenthe invalid logical block is present in the MS, the logical-NAND-layermanaging unit 120 b returns the invalid logical bock to thephysical-NAND-layer managing unit 120 c (step S405). In an entry of theMS logical block management table 35 corresponding to the returnedinvalid logical block, the valid flag 35 e is set invalid and the numberof valid logical blocks VBL of the MS structure management table 60 isdecremented. The logical-NAND-layer managing unit 120 b directly moves afull logical block in the MSFB 11 aa to the MS 11 and moves a fulllogical block in the MS additional recording IB 11 ab to the TFS 11 b(step S407). This Move processing is processing for only deletingrelevant logical block IDs registered in the field 61 a for the MSFB andthe field 61 b for the MS additional recording IB of the MS buffermanagement table 61 of the MS structure management table 60.

The logical-NAND-layer managing unit 120 b compares the number of validlogical blocks VBL as state information of the MS structure managementtable 60 with the maximum number of logical blocks MBL (step S410). As aresult of the comparison, when the number of valid logical blocks VBLexceeds the maximum number of logical blocks MBL, the logical-NAND-layermanaging unit 120 b judges that the free blocks FB are insufficient,executes MS compaction processing explained below block by block,increases invalid logical blocks that should be returned to thephysical-NAND-layer managing unit 120 c entirely configured by invalidtracks, and reduces the number of valid logical blocks VBL to be smallerthan the maximum number of blocks MBL (step S420). When the free blocksFB are not insufficient in the judgment at step S410, the procedure isshifted to step S440.

As the MS compaction processing, as explained above, there are twotypes, i.e., 2^(i) track MS compaction and less than 2^(i) track MScompaction. In the 2^(i) track MS compaction, the MS compaction buffer11 c is used and a logical block used as the MS compaction buffer 11 cafter the compaction is moved to the top of the TFS 11 b. In the lessthan 2^(i) track MS compaction, valid tracks are copied to the MSadditional recording IB 11 ab.

First, the logical-NAND-layer managing unit 120 b executes the 2^(i)track MS compaction for collecting 2^(i) tracks from logical blocks witha small number of valid tracks referring to the logical block ID list bythe numbers of valid tracks 62 of the MS structure management table 60and copying the collected 2^(i) tracks to the MS compaction buffer 11 cacquired from the physical-NAND-layer managing unit 120 c.

Specifically, the logical-NAND-layer managing unit 120 b issues anacquisition request for a free block FB to the physical-NAND-layermanaging unit 120 c and acquires a free block FB together with a logicalblock ID allocated as the free bock FB. The logical-NAND-layer managingunit 120 b requests the physical-NAND-layer managing unit 120 c to copya plurality of tracks selected as compaction objects to the free blockFB. When the tracks as the compaction objects have valid clusters in theWC 21, the FS unit 12Q, and the IS unit 13Q, the logical-NAND-layermanaging unit 120 b executes the passive merge for collecting andmerging the valid clusters in the MS compaction buffer 11 c.

When the completion of the compaction is notified from thephysical-NAND-layer managing unit 120 c, the logical-NAND-layer managingunit 120 b updates the logical block ID 30 c in an entry having thelogical track addresses 30 a corresponding to the tracks subjected tothe compaction of the track management table 30 a to the logical blockID of the free block FB acquired from the physical-NAND-layer managingunit 120 c and updates the intra-logical block track position 30 d.

The logical-NAND-layer managing unit 120 b registers the logical blockID of the free block FB acquired from the physical-NAND-layer managingunit 120 c, which is used as the MS compaction buffer 11 c, as a newentry in the MS logical block management table 35 and registers requiredinformation in respective fields in the entry. As the registration,there are update of the track management pointer 35 b, update of thenumber of valid tracks, update of the writable top track 35 d, and thelike.

The logical-NAND-layer managing unit 120 b registers the logical blockID used as the MS compaction buffer 11 c at the top of the FIFOstructure (the linked list) of the field 61 c for the TFS of the MSbuffer management table 61 of the MS structure management buffer 60 tomove the MS compaction buffer 11 c configured by one logical blockincluding the valid 2^(i) tracks as a result of the MS compaction to thetop (an oldest position) of the TFS 11 b. When the TFS 11 b is full, anoldest logical block at the top is moved to the MS 11.

Subsequently, the data managing unit 120 invalidates old track at acompaction source in the MS 11.

Specifically, the logical-NAND-layer managing unit 120 b deletes arelevant section of a field of the track management pointer 35 b in anentry corresponding to a logical block at the compaction source in theMS logical block management table 35, decrements the number of validtracks 35 c, and updates the logical block ID list by the number ofvalid tracks 62 of the MS structure management table 60. When the numberof valid tracks 35 c is reduced to 0 by the decrement, thelogical-NAND-layer managing unit 120 b decrements the number of validlogical blocks VBL of the MS structure management table 60, and returnsthis invalid logical block to the physical-NAND-layer managing unit 120c. The valid flag 35 e of an entry of the MS logical block managementtable 35 corresponding to the returned logical block is set invalid.

When such compaction processing and processing for returning the invalidlogical block FB are finished, the logical-NAND-layer managing unit 120b compares the number of valid logical blocks VBL and the maximum numberof logical blocks MBL. When the number of valid logical blocks VBLexceeds the maximum number of logical blocks MBL, the logical-NAND-layermanaging unit 120 b executes the 2^(i) track MS compaction forcollecting 2^(i) valid tracks again. When the 2^(i) track MS compactionfor collecting 2^(i) valid tracks is impossible in a state in which thenumber of valid logical blocks VBL exceeds the maximum number of logicalblocks MBL, the logical-NAND-layer managing unit 120 b executes the lessthan 2^(i) track MS compaction.

In the less than 2^(i) track MS compaction, the logical-NAND-layermanaging unit 120 b copies tracks in a number less than the 2^(i) tracksas the compaction objects to the MS additional recording IB 11 ab togenerates an invalid logical block formed by the invalid 2^(i) tracks.The logical-NAND-layer managing unit 120 b returns the generated invalidlogical block to the physical-NAND-layer managing unit 120 c to reducethe number of valid logical blocks VBL. Explanation of update of themanagement tables for the less than 2^(i) track MS compaction isomitted.

CIB Processing in the FS 12

The CIB processing in the FS 12 explained at step S340 in FIG. 19 isexplained in detail. The logical-NAND-layer managing unit 120 b acquiresinformation of the number of valid clusters concerning the logical blockIDs registered in the field 66 a for the FSFB and the field 66 b for theFS additional recording IB of the FS input buffer management table 66 ofthe FS/IS structure management table 65 from a field of the number ofvalid clusters 42 d of the FS/IS logical block management table 32. Thelogical-NAND-layer managing unit 120 b checks whether one or more fulllogical blocks, in which all logical pages are written with clusters,are present in the FSFB 12 aa or the FS additional recording IB 12 ab ofthe FSIB 12 a (step S440). When one or more full logical blocks arepresent in the FSIB 12 a, the logical-NAND-layer managing unit 120 bperforms the processing explained below. When the judgment at step S440is NO, the procedure is finished here.

When the judgment at step S440 is YES, the logical-NAND-layer managingunit 120 b checks whether an invalid logical block, the number of validclusters 42 d of which is 0, is present in the FS unit 12Q referring tothe number of valid clusters 42 d of the FS/IS structure managementtable 65 and the FS/IS logical block management table 42. When theinvalid logical block is present in the FS unit 12Q, thelogical-NAND-layer managing unit 120 b returns the invalid logical blockto the physical-NAND-layer managing unit 120 c (step S445).

An entry of the returned logical block is deleted from the MS logicalblock management table 35 and the FS/IS logical block management table42. The logical-NAND-layer managing unit 120 b moves a full logicalblock in the FSFB 12 aa to the FS 12 and moves a full logical block inthe FS additional recording IB 12 ab to the FS 12 (step S447).Specifically, the Move processing is processing for only deletingrelevant logical block IDs registered in the field 66 a for the FSFB andthe field 66 b for the FS additional recording IB of the FS input buffermanagement table 66 of the FS/IS structure management table 65.

The logical-NAND-layer managing unit 120 b judges whether the number oflogical blocks of the FS 12 having the FIFO structure exceeds apredetermined maximum number of logical blocks BLfsmax allowed for theFS 12 (step S450). Specifically, the logical-NAND-layer managing unit120 b judges whether the number of logical blocks calculated from the FSFIFO management table 67 exceeds the maximum number of logical blocksBLfsmax set in advance.

As a result of this comparison, when the calculated number of logicalblocks exceeds the maximum number of logical blocks BLfsmax, thelogical-NAND-layer managing unit 120 b executes flush processing for,for example, two logical blocks at a time to the MS 11 (step S460) andflush processing for one logical block to the IS 13 (step S500)according to a state at that point. When the FS 12 is not full in thejudgment at step S450, the logical-NAND-layer managing unit 120 bfinishes the processing here without performing flush processing fromthe FS 12 to the MSIB 11 a and flush processing from the FS 12 to theISIB 13 a.

In the flush processing from the FS 12 to the MSIB 11 a, first, thelogical-NAND-layer managing unit 120 b judges whether there is a logicalblock directly copied to the MSIB 11 a without being moved through theIS unit 13Q from the FS 12 (step S455). Specifically, thelogical-NAND-layer managing unit 120 b checks clusters in an oldestlogical block at the top of the FIFO of the FS 12 in order one by oneand searches how many valid clusters a track to which the clustersbelong has in the FS unit 12Q referring to a field of the number of FSclusters 31 f of the track management table 30. When the number of validclusters in the track is equal to or larger than a predeterminedthreshold (e.g., 2^(k−i−1)), the logical-NAND-layer managing unit 120 bsets the logical track address as a track decided to be flushed to theMSIB 11 a.

The search is performed through a route explained below.

1. The logical-NAND-layer managing unit 120 b obtains an oldest FS/ISblock ID at the top of the FIFO from the FS FIFO management table 65 ofthe FS/IS structure management table 65.

2. The logical-NAND-layer managing unit 120 b obtains an index to theintra-FS/IS cluster management table 44 from a field of the intra-blockcluster table 42 c in an entry of the FS/IS logical block managementtable 42 corresponding to the FS/IS block ID.

3. The logical-NAND-layer managing unit 120 b obtains one pointer to theFS/IS management table 40 from each entry in one logical blockdesignated by the index obtained in the intra-FS/IS cluster managementtable 44 and jumps to a relevant link of the FS/IS management table 40.

4. The logical-NAND-layer managing unit 120 b obtains a relevant logicaltrack address to which the link at a jump destination belongs.

5. The logical-NAND-layer managing unit 120 b checks a field of thenumber of FS clusters 30 f in a relevant entry of the track managementtable 30 using the obtained logical track address.

6. The logical-NAND-layer managing unit 120 b repeats 3 to 5 explainedabove.

The flush processing from the FS 12 to the MS 11 is performed for, forexample, two logical blocks at a time (block Copy). In other words, thelogical-NAND-layer managing unit 120 b collects tracks having the numberof intra-track valid clusters equal to or larger than a predeterminedthreshold (e.g., 2^(k−i−1)) for two logical blocks and flushes thecollected tracks for two logical blocks to the MSFB 11 aa of the MSIB 11a (step S460). In the flush processing, concerning clusters not presentin the FS 12 in the flushed track, the logical-NAND-layer managing unit120 b executes the track padding for collecting the missing clustersfrom the MS unit 11Q and the passive merge for collecting valid clustersincluded in logical address range of the flushed tracks from the WC 21and the IS unit 13Q.

However, when tracks decided to be flushed to the MSIB 11 a are notpresent for two logical blocks, the logical-NAND-layer managing unit 120b flushes one logical block to the MSFB 11 aa of the MSIB 11 a (blockCopy) and additionally records tracks not enough for one logical blockin the MS additional recording IB 11 ab in track units (track Copy)(step S460). Similarly, when tracks decided to be flushed to the MSIB 11a are not present for one logical block, the logical-NAND-layer managingunit 120 b additionally records tracks not enough for one logical blockin the MS additional recording IB 11 ab in track units (track Copy)(step S460). Thereafter, when no valid cluster is left in the toplogical block of the FS 12 of the FIFO structure, the logical-NAND-layermanaging unit 120 b returns the top logical block to thephysical-NAND-layer managing unit 120 c as an invalid logical block.

CIB processing in the MS 11 (step S350 in FIG. 19)

When the flush from the FS 12 to the MSIB 11 a is performed in this way,the CIB processing in the MS unit 11Q is again executed (step S480). TheCIB processing in the MS unit 11Q at step S480 is the same as the CIBprocessing in the first time in the MS unit 11Q (steps S400 to S420).Therefore, redundant explanation is omitted. After the CIB processing inthe MS unit 11Q, the logical-NAND-layer managing unit 120 b checks inthe same manner as explained above whether a condition for flush fromthe FS 12 to the MSIB 11 a is satisfied (step S455). When the flushcondition is satisfied, the flush of every two logical blocks from theFS 12 to the MSIB 11 a and the CIB processing in the MS 11 explainedabove is again executed. Such processing is repeated until the judgmentNO is obtained at step S455.

CIB Processing in the FS 12

When the judgment at step S455 is NO, the logical-NAND-layer managingunit 120 b judges whether a condition for flush from the FS 12 to theISIB 13 a is satisfied (step S490). Specifically, in the flushprocessing from the FS 12 to the MSIB 11 a, when a valid cluster is leftin the checked top logical block of the FS 12 in a full state having theFIFO structure, the logical-NAND-layer managing unit 120 b executesflush from the FS 12 to the ISIB 13 a assuming that condition for flushfrom the FS 12 to the IS 13 at step S490 is satisfied.

When the condition is satisfied at step S490, the logical-NAND-layermanaging unit 120 b moves the top logical block including only clustersnot included in the track flushed to the MSIB 11 a to the ISIB 13 a(block Move) (step S500). At step S500, the logical-NAND-layer managingunit 120 b executes, for example, flush of one logical block. Dependingon a state, thereafter, after performing the procedure at steps S520 toS585, the logical-NAND-layer managing unit 120 b may perform the flushfrom the FS 12 to the ISIB 13 a at step S500 again according to thejudgment at step S590.

A state in which the flush is performed again at step S500 is a state inwhich, for example, when a buffer (the FSFB 12 a or the FS additionalrecording IB 12 ab) having a plurality of full logical blocks is presentin the FSIB 12 a, if the FS 12 having the FIFO structure is full, flushof a plurality of logical blocks from the FS 12 to the MSIB 11 a or theISIB 13 a is performed according to the move of a full block from theFSIB 12 a to the FS 12. Under such a condition, it is likely that flushof a plurality of logical blocks from the FS 12 to the ISIB 13 a isperformed. CIB processing in the IS (step S360 in FIG. 19)

Details of flush processing and compaction processing performed in theIS 13 when the condition at step S490 is satisfied are explained withreference to, besides FIG. 30, a flowchart shown in FIG. 31. First, inthe same manner as explained above, the logical-NAND-layer managing unit120 b checks whether an invalid logical block is present in the IS unit13Q and, when an invalid logical block is present in the IS unit 13Q,returns the invalid logical block to the physical-NAND-layer managingunit 120 c (step S520). In entries of the MS logical block managementtable 35 and the FS/IS logical block management table 42 correspondingto an entry of the returned logical block, the valid flags 35 e and 42 fare set invalid.

The logical-NAND-layer managing unit 120 b judges whether the number oflogical blocks of the IS 13 having the FIFO structure exceeds thepredetermined maximum number of logical blocks BLismax allowed for theIS 13 (step S530). Specifically, the logical-NAND-layer managing unit120 b judges whether the number of logical blocks calculated from the ISFIFO management table 69 exceeds the maximum number of logical blocksBLismax set in advance.

As a result of the comparison, when the calculated number of logicalblocks exceeds the maximum number of logical blocks BLismax, thelogical-NAND-layer managing unit 120 b flushes tracks for, for example,two logical blocks at a time from the IS 13 to the MSFB 11 aa of theMSIB 11 a (step S540). When the IS 13 is not full in the judgment atstep S530, the logical-NAND-layer managing unit 120 b moves a fulllogical block in the ISIB 13 a to the IS 13 b without performing flushprocessing to the MSIB 11 a (step S585).

In the flush at step S540, the logical-NAND-layer managing unit 120 bexecutes processing for selecting a track to be flushed shown in FIG. 31using the track management table 30 or the like shown in FIG. 12. InFIG. 31, the logical-NAND-layer managing unit 120 b starts the selectionprocessing (cyclic search processing; hereinafter simply referred to assearch processing) (step S700). The logical-NAND-layer managing unit 120b starts a search from the next logical track address of the logicaltrack address 30 a as an index of the track management table 30 storedat step S740 as a final searched track in the last search (step S710).

When the search is a search for the first time (a first cycle), thelogical-NAND-layer managing unit 120 b starts the search from a firstentry of the track management table 30 (step S710). When the searchedtrack stored at step S740 is a final entry (a track n in FIG. 12) of thetrack management table 30, in the next track search at step S710, thelogical-NAND-layer managing unit 120 b returns to the top entry (a track0 in FIG. 12).

In this search, referring to a field (the number of valid clusters in arelevant logical track address) of the number of IS clusters 30 g in theentry of the track management table 30, when a valid cluster is storedin the entry of the IS 13, the logical-NAND-layer managing unit 120 bregisters a logical track address of the entry in a not-shown newlysearched track list (step S720). The logical-NAND-layer managing unit120 b compares the number of tracks registered in the newly searchedtrack list with a predetermined threshold L. When the number ofregistered track is smaller than the threshold L, the logical-NAND-layermanaging unit 120 b shifts the procedure to step S710 and checks thenext entry of the track management table 30 in the same manner asexplained above.

By repeating such processing, the logical-NAND-layer managing unit 120 bregisters logical track addresses for the threshold L in the newlysearched track list (“Yes” at step S730). The logical-NAND-layermanaging unit 120 b stores an entry (an index) of the track managementtable 30 corresponding to a logical track addresses registered in thenewly searched track list last as a searched last track and finishes thesearch in the present cycle (step S740).

The logical-NAND-layer managing unit 120 b judges whether there is anunselected track list in which logical track addresses not selected lasttime (not shown) are listed (step S750). In the case of the first cycle,because the unselected track list is not present, the logical-NAND-layermanaging unit 120 b selects 2^(i+1) logical tracks based on two lists,i.e., the newly searched track list and newly added intra-block tracklist (not shown) (step S760). The newly added intra-block track list isa list concerning tracks included in the logical block (entered in theIS input buffer management table 68 of the FS/IS structure managementtable 65) flushed from the FS 12 to the IS unit 13Q at step S500 in FIG.30.

In the first cycle, the logical-NAND-layer managing unit 120 b selects2^(i+1) tracks as flush candidates using such two lists. In theselection, as explained above, a selection reference (score value) Sobtained by using the number of valid clusters in track and a validcluster coefficient is used.Score value S=the number of valid clusters in track×valid clustercoefficient

The valid cluster coefficient is a number weighted according to whethera track is present in a logical block in which an invalid track ispresent in the MS unit 11Q. The number is larger when the track ispresent than when the track is not present.

The number of valid clusters can be acquired by looking at a field ofthe number of IS clusters 30 g of the track management table 30. Thevalid cluster coefficient can be acquired by looking at a field of thenumber of valid tracks 35 c of the MS logical block management table 35linked to the track management table 30 by a field of the trackmanagement pointer 35 b.

The logical-NAND-layer managing unit 120 b selects M (a predeterminedset value) tracks with larger score values S from a plurality of tracksincluded in the newly added intra-block track list. Thelogical-NAND-layer managing unit 120 b adds L tracks registered in thenewly searched track list by the prior search to the selected M tracksand selects 2^(i+1) tracks with higher score values S from the L+Mtracks as tracks to be flushed to the MS 11. The logical-NAND-layermanaging unit 120 b registers tracks other than the selected 2^(i+1)tracks among the L+M tracks in the unselected track list.

In a second or subsequent cycle, the logical-NAND-layer managing unit120 b selects 2^(i+1) tracks based on three lists, i.e., the unselectedtrack list, the newly searched track list, and the newly addedintra-block track list (step S770). It is determined according tojudgment at step S570 in FIG. 30 explained later whether flush for asecond or subsequent time should be performed. In the selectionprocessing using the three lists, the logical-NAND-layer managing unit120 b selects N (a predetermined set value) tracks with higher scorevalues S from a plurality of tracks included in the unselected tracklist, selects M (a predetermined set value) tracks with higher scorevalues S from a plurality of tracks included in the newly addedintra-block track list, adds L tracks registered in the newly searchedtrack list obtained in the present second or subsequent cycle to the N+Mtracks, and selects 2¹⁺¹ tracks with higher score values S out of theL+M+N tracks as tracks to be flushed to the MS 11. Thelogical-NAND-layer managing unit 120 b registers tracks other than theselected 2^(i+1) tracks among the L+M+N logical tracks in the unselectedtrack list used in the next cycle.

Referring back to step S540 in FIG. 30, when the flush candidates of thetracks for two logical blocks are selected as explained above, thelogical-NAND-layer managing unit 120 b flushes the selected tracks fortwo logical blocks (i.e., 2 ^(i+1) tracks) to the MSFB 11 aa of the MSIB11 a (step S540). In the flush processing, concerning clusters notpresent in the IS unit 13Q among the tracks to be flushed, thelogical-NAND-layer managing unit 120 b executes the track padding forcollecting the missing clusters from the MS 11 unit 11Q and the passivemerge for collecting valid clusters included in logical address range ofthe flushed tracks from the WC 21 and the FS unit 12Q. In the abovedescription, the tracks to be flushed are selected according to thescore value S based on the number of valid clusters and the coefficientindicating whether porous blocks are present in the MS. However, tracksto be flushed may be selected according to only the number of validclusters.

CIB Processing in the MS (step S370 in FIG. 19)

When the flush from the IS 13 to the MSIB 11 a is performed in this way,the CIB processing in the MS 11 is again executed (step S560). The CIBprocessing in the MS 11 at step S560 is the same as the CIB processingin the MS 11 in the first time (steps S400 to S420). Therefore,redundant explanation is omitted.

CIB Processing in the IS

The logical-NAND-layer managing unit 120 b judges whether flush from theIS 13 to the MSIB 11 a should be executed again (step S570). Thelogical-NAND-layer managing unit 120 b sorts, using fields of the MSlogical block management table 35 and the number of valid clusters 42 dof the FS/IS logical block management table 42 and the like, logicalblocks in the IS 13 after the flush at step S540 in order from one witha smallest number of valid clusters. When a total number of validclusters of two logical blocks with a smallest number of valid clustersis equal to or larger than 2^(k) (for one logical block), which is apredetermined set value, the logical-NAND-layer managing unit 120 bjudges that a condition for flush from the IS 13 to the MSIB 11 a issatisfied (step S570).

When the condition for flush from the IS 13 to the MSIB 11 a issatisfied, the logical-NAND-layer managing unit 120 b shifts theprocedure to step S540 and executes steps S700 to S750 and S770 in FIG.31 to execute the flush processing for two logical blocks explainedabove again. As long as the judgment at step S570 is YES, thelogical-NAND-layer managing unit 120 b repeatedly executes the flushprocessing for two logical blocks from the IS 13 to the MSIB 11 a andthe CIB processing in the MS 11. When the judgment at step S570 is NO,the logical-NAND-layer managing unit 120 b executes the compactionprocessing in the IS 13 (step S580).

In the IS compaction processing, the logical-NAND-layer managing unit120 b collects, using fields of the MS logical block management table 35and the number of valid clusters 42 d of the FS/IS logical blockmanagement table 42 and the like, clusters for one logical block inorder from a logical block having a smallest number of valid clusters inthe IS unit 13Q, i.e., 2^(k) clusters and copies the 2^(k) clusters tothe IS compaction buffer 13 c. When this copy processing is finished,the logical-NAND-layer managing unit 120 b returns logical blockswithout valid clusters among the logical blocks at a compaction source(a Copy source) to the physical-NAND-layer managing unit 120 c asinvalid logical blocks. The logical-NAND-layer managing unit 120 b movesthe IS compaction buffer 13 c configured by logical blocks filled withvalid clusters by the compaction processing to the IS 13.

After this compaction, full logical blocks in the ISIB 13 a is moved tothe IS 13 (step S585). Specifically, this Move processing is processingfor only deleting a relevant logical block ID registered in the fieldfor the ISIB of the IS input buffer management table 68 of the FS/ISstructure management table 65.

Thereafter, the logical-NAND-layer managing unit 120 b judges whetherthe condition for flush from the FS 12 to the ISIB 13 a is satisfied(step S590). When the condition for flush from the FS 12 to the ISIB 13a is satisfied, the logical-NAND-layer managing unit 120 b shifts theprocedure to step S500 and repeats the procedure again. After the IScompaction processing is finished, when it is judged that the conditionfor flush from the FS 12 to the ISIB 13 a is not satisfied, thelogical-NAND-layer managing unit 120 b finishes the present writeprocessing. The above is the details of the write processing.

As explained above, according to the present embodiment, MSIB 11 a isconfigured so as to include the MSFBs 11 aa to which data iscollectively written in units of blocks, in addition to the MSadditional IBs 11 ab to which data is additionally written in units oftracks. Into the MSFBs 11 aa, blocks are copied from the WC 21, the FS12, and the IS 13. By having the MSFBs 11 aa, it is possible to flushthe data from the WC 21, the FS 12, and the IS 13 efficiently and withhigh (better) writing efficiency.

More specifically, the TFS 11 b having a function equivalent to that ofthe FS 12 is provided at the pre-stage of the MS 11. By having the TFS11 b, it is possible to reduce the likelihood of having such data thathas a high update frequency mixed into the MS compaction processingperformed in the MS 11, which is provided at the stage subsequent to theTFS 11 b. This effect can be further explained as follows: Even thecompaction processing has a side effect where the number of times datais erased from blocks increases due to the data rewriting into otherblocks. In other words, the problem is that, if the data that has beenselected for the compaction processing and has been rewritten into a newblock is immediately updated, the number of times data is erased fromthe blocks increases. For this reason, it is desirable to select suchdata that has a low update frequency as the target of the compactionprocessing. The TFS 11 b is provided for the purpose of selecting suchdata.

However, because the TFS 11 b has a FIFO structure, if only the TFS 11 bwere provided at the pre-stage of the MS 11, it would not be possible toefficiently flush the data from the WC 21, FS 12, and the IS 13 to theMS 11. As a result, it would not be possible to perform the WCFprocessing and the CIB processing including the flush processing and theIS compaction processing described above, efficiently and with highwriting efficiency. To cope with this situation, according to thepresent embodiment, the MSFBs 11 aa to which data is written in units ofblocks are provided at the pre-stage of the MS 11, so that the outputsof the MSFBs 11 aa are input to the MS 11 while bypassing the TFS 11 b.As a result, it is possible to perform the WCF processing and the CIBprocessing efficiently with little delay.

For example, according to the present embodiment, prior to thecompaction processing in the IS 13, the data in a plurality of blocksare flushed to the MS 11 at step S540 shown in FIG. 30. In this manner,prior to the compaction processing, the IS 13 is arranged to be in sucha state that the compaction processing can be performed easily. Morespecifically, when the compaction processing is performed in the IS 13,there are two possible states that the IS 13 can be in as follows: afirst state is that the IS 13 has two or more logical blocks each havinga small number of valid clusters; and a second state is that the IS 13does not have two or more blocks each having a small number of validclusters. When the IS 13 is in the first state, it is possible toperform the compaction processing without any further action. On thecontrary, when the IS 13 is in the second state, it is not possible toperform the compaction processing efficiently, unless some actions aretaken. Thus, according to the present embodiment, a plurality of blocksthat are constituted with a plurality of higher-scoring tracks having alarger number of valid clusters and being sorted out because the MS hasporous blocks are flushed to the MS 11 prior to the compactionprocessing. With this arrangement, it is possible to cause the IS 13 toshift into the first state before the compaction processing isperformed.

When the data is flushed from the IS 13 as described above, if the MSFBs11 aa were not provided, it would not be possible to efficiently flushthe data from the IS 13 to the MS 11. In addition, there would also be adelay in the IS compaction processing itself. The same applies to theflushing of the data from the WC 21 and from the FS 12. If only the TFS11 b were provided, it would not be possible to flush the data from theWC 21 and the FS 12 efficiently and in a short period of time. Thiswould also cause a delay in the write processing itself.

As explained above, according to the present embodiment, the MSFBs 11 aato which the data is written in units of blocks are provided in thepre-stage of the MS 11, so that the pieces of data in units of blocksthat have been written to the MSFBs 11 aa are immediately moved to theMS 11 while bypassing the TFS 11 b. With this arrangement, it ispossible to efficiently perform the processing of flushing the data fromthe WC 21, the FS 12, and the IS 13 and to increase the speed of thewrite processing. In addition, because the data is written in units ofblocks, it is possible to improve the writing efficiency, and thiscontributes to making the life of the NAND memory longer.

In the description above, in the case where any one of the MSFBs 11 aahas one or more full blocks in each of which data is written in all thetracks, the data is moved from the MSFB 11 aa to the MS 11; however,another arrangement is acceptable in which the data is moved from theMSFB 11 aa to the MS 11 when the number of logical blocks that areallocated as the MSFB 11 aa has exceeded the number of entries (i.e., atolerance value) allocated in the MSFB field 61 a in the MS structuremanagement table 60 or at an arbitrary point in time before the numberof allocated logical blocks exceeds the tolerance value.

Also, according to the present embodiment, prior to the compactionprocessing in the IS 13, a plurality of blocks that are constituted witha plurality of higher-scoring tracks having a larger number of validclusters and being sorted out because the MS has porous blocks (thefewer valid tracks are included in the logical block to which a trackbelongs, the higher is the score of the track) are flushed to the MS 11at step S540 in FIG. 30. With this arrangement, prior to the compactionprocessing, it is possible to arrange the IS 13 to be in such a statethat the compaction processing can be performed easily. Morespecifically, when the compaction processing is performed in the IS 13,there are two possible states that the IS 13 can be in as follows: thefirst state is that the IS 13 has two or more logical blocks each havinga small number of valid clusters; and the second state is that the IS 13does not have two or more blocks each having a small number of validclusters. When the IS 13 is in the first state, it is possible toperform the compaction processing without any further action. On thecontrary, when the IS 13 is in the second state, it is not possible toperform the compaction processing efficiently, unless some actions aretaken. Thus, according to the present embodiment, the plurality ofblocks that are constituted with the plurality of higher-scoring trackshaving a larger number of valid clusters and being sorted out becausethe MS has porous blocks are flushed to the MS 11 prior to thecompaction processing. With this arrangement, it is possible to causethe IS 13 to shift into the first state before the compaction processingis performed. As a result, it is possible to equalize the time it takesto perform each cycle of compaction processing and to increase the speedof the compaction processing. Another arrangement is acceptable in whichthe tracks to be flushed to the MS 11 are selected while using only thenumber of valid clusters as the condition of selection. Yet anotherarrangement is acceptable in which the tracks to be flushed to the MS 11are selected while using only the valid cluster coefficient as thecondition of selection, the valid cluster coefficient being configuredso as to give a score to each of the tracks in such a manner that thefewer valid tracks are included in the logical block to which a trackbelongs, the higher is the score of the track.

According to the present embodiment, instead of searching through allthe entries in the track management table 30, the logical tracks ofwhich the total quantity is 2^(i+1) and that have a higher score S areselected as the logical tracks to be flushed to the MS 11, from among(i) the logical tracks of which the total quantity is N and that have ahigher score S within the unselected track list; (ii) the logical tracksof which the total quantity is M and that have a higher score S withinthe list of the tracks in a newly added block (i.e., the “newly addedintra-block track list”); and (iii) the logical tracks of which thetotal quantity is L within a newly searched track list showing tracksthat have been selected because valid clusters are included. With thisarrangement, it is possible to improve the speed of the search whilemaintaining the level of precision of the search based on the scorevalues. Also, when the newly searched track list is created by searchingthrough the track management table 30, a search called a cyclic searchis conducted during which the final searched track is remembered so thata search at the next time starts from the next track after theremembered final searched track. With this arrangement, even if thesearch is not conducted through all the entries in the track managementtable 30 for the purpose of improving the speed of the search, it ispossible to ensure, as a result, that the searched portions are notunevenly distributed and that the precision levels of the searchingprocesses are equalized.

As explained above, in writing of quaternary data, write processing forlower-order page data and write processing for higher-order page dataare necessary. If the write processing for higher-order page data isabnormally finished or forced to be suspended by a suspension commandinput or the like, the memory cell as a target of the write processingis in an incomplete threshold voltage state halfway in writing. In thisunfinished state, readout of the lower-order page data normally writtenin the memory cells is impossible either. Therefore, when writeprocessing for the higher-order page data is performed, processing fortemporarily storing data of a lower-order page finished to be written (awritten lower-order page corresponding to a higher-order page to bewritten) is necessary. In the nonvolatile semiconductor storage elementemploying the multi-value data storage system, a phenomenon in whichdata of a lower-order page written earlier is also broken by, forexample, power-down or the like during writing of a higher-order page ina certain memory cell is referred to as writing failure during powersupply short break (hereinafter simply referred to as “writingfailure”). Measures for preventing failure of this type are referred toas writing failure measure processing during power supply short break(hereinafter simply referred to as “writing failure measureprocessing”).

Therefore, in the memory system according to this embodiment, an amountof writing in logical block units for which the writing failure measuresprocessing do not have to be performed is increased to realizeefficiency of the write processing. Accordingly in this memory system, adata flushing with which writing in block units tends to be performedfrom the WC 21, the FS12, or the IS13 to the MS11 is adopted.

The present invention is not limited to the embodiments described above.Accordingly, various modifications can be made without departing fromthe scope of the present invention.

Furthermore, the embodiments described above include variousconstituents with inventive step. That is, various modifications of thepresent invention can be made by distributing or integrating anyarbitrary disclosed constituents.

For example, various modifications of the present invention can be madeby omitting any arbitrary constituents from among all constituentsdisclosed in the embodiments as long as problem to be solved by theinvention can be resolved and advantages to be attained by the inventioncan be attained.

Furthermore, it is explained in the above embodiments that a clustersize multiplied by a positive integer equal to or larger than two equalsto a logical page size. However, the present invention is not to be thuslimited.

For example, the cluster size can be the same as the logical page size,or can be the size obtained by multiplying the logical page size by apositive integer equal to or larger than two by combining a plurality oflogical pages.

Moreover, the cluster size can be the same as a unit of management for afile system of OS (Operating System) that runs on the host apparatus 1such as a personal computer.

Furthermore, it is explained in the above embodiments that a track sizemultiplied by a positive integer equal to or larger than two equals to alogical block size. However, the present invention is not to be thuslimited.

For example, the track size can be the same as the logical block size,or can be the size obtained by multiplying the logical block size by apositive integer equal to or larger than two by combining a plurality oflogical blocks.

If the track size is equal to or larger than the logical block size, MScompaction processing is not necessary. Therefore, the TFS 11 b can beomitted.

Second Embodiment

FIG. 22 shows a perspective view of an example of a personal computer. Apersonal computer 1200 includes a main body 1201 and a display unit1202. The display unit 1202 includes a display housing 1203 and adisplay device 1204 accommodated in the display housing 1203.

The main body 1201 includes a chassis 1205, a keyboard 1206, and a touchpad 1207 as a pointing device. The chassis 1205 includes a main circuitboard, an ODD unit (Optical Disk Device), a card slot, and the SSD 1100described in the first embodiment.

The card slot is provided so as to be adjacent to the peripheral wall ofthe chassis 1205. The peripheral wall has an opening 1208 facing thecard slot. A user can insert and remove an additional device into andfrom the card slot from outside the chassis 1205 through the opening1208.

The SSD 1100 may be used instead of the prior art HDD in the state ofbeing mounted in the personal computer 1200 or may be used as anadditional device in the state of being inserted into the card slot ofthe personal computer 1200.

FIG. 23 shows a diagram of an example of system architecture in apersonal computer. The personal computer 1200 is comprised of CPU 1301,a north bridge 1302, a main memory 1303, a video controller 1304, anaudio controller 1305, a south bridge 1309, a BIOS-ROM 1310, the SSD1100 described in the first embodiment, an ODD unit 1311, an embeddedcontroller/keyboard controller (EC/KBC) IC 1312, and a networkcontroller 1313.

The CPU 1301 is a processor for controlling an operation of the personalcomputer 1200, and executes an operating system (OS) loaded from the SSD1100 to the main memory 1303. The CPU 1301 executes these processes,when the ODD unit 1311 executes one of reading process and writingprocess to an optical disk. The CPU 1301 executes a system BIOS (BasicInput Output System) stored in the BIOS-ROM 1310. The system BIOS is aprogram for controlling a hard ware of the personal computer 1200.

The north bridge 1302 is a bridge device which connects the local bus ofthe CPU 1301 to the south bridge 1309. The north bridge 1302 has amemory controller for controlling an access to the main memory 1303. Thenorth bridge 1302 has a function which executes a communication betweenthe video controller 1304 and the audio controller 1305 through the AGP(Accelerated Graphics Port) bus.

The main memory 1303 stores program or data temporary, and functions asa work area of the CPU 1301. The main memory 1303 is comprised of, forexample, DRAM. The video controller 1304 is a video reproduce controllerfor controlling a display unit which is used for a display monitor (LCD)1316 of the portable computer 1200. The Audio controller 1305 is anaudio reproduce controller for controlling a speaker of the portablecomputer 1200.

The south bridge 1309 controls devices connected to the LPC (Low PinCount) bus, and controls devices connected to the PCI (PeripheralComponent Interconnect) bus. The south bridge 1309 controls the SSD 1100which is a memory device stored soft ware and data, through the ATAinterface.

The personal computer 1200 executes an access to the SSD 1100 in thesector unit. For example, the write command, the read command, and thecache flash command are input through the ATA interface. The southbridge 1309 has a function which controls the BIOS-ROM 1310 and the ODDunit 1311.

The EC/KBC 1312 is one chip microcomputer which is integrated on theembedded controller for controlling power supply, and the key boardcontroller for controlling the key board (KB) 1206 and the touch pad1207. The EC/KBC 1312 has a function which sets on/off of the powersupply of the personal computer 1200 based on the operation of the powerbutton by user. The network controller 1313 is, for example, acommunication device which executes the communication to the network,for example, the internet.

Although the memory system in the above embodiments is comprised as anSSD, it can be comprised as, for example, a memory card typified by anSD™ card. Moreover, the memory system can be applied not only to apersonal computer but also to various electronic devices such as acellular phone, a PDA (Personal Digital Assistant), a digital stillcamera, a digital video camera, and a television set.

Additional advantages and modifications will readily occur to thoseskilled in the art. Therefore, the invention in its broader aspects isnot limited to the specific details and representative embodiments shownand described herein. Accordingly, various modifications may be madewithout departing from the spirit or scope of the general inventiveconcept as defined by the appended claims and their equivalents.

1. A memory system comprising: a first storing area as a cache memoryincluded in a volatile semiconductor memory; second and third storingareas included in a nonvolatile semiconductor memory in which datareading and writing is performed by a page unit and data erasing isperformed by a physical block unit that is twice or larger naturalnumber times as large as the page unit; a first input buffer included inthe nonvolatile semiconductor memory that functions as an input bufferfor the third storing area; a second input buffer included in thenonvolatile semiconductor memory that functions as an input buffer forthe third storing area and that separately stores data with a highupdate frequency for the third storing area; and a controller thatallocates a storage area of the nonvolatile semiconductor memory to thesecond and third storing areas in logical block unit associated with oneor more of physical blocks, wherein the controller executes: firstprocessing for flushing a plurality of data in sector unit written inthe first storing area to the second storing area as data in firstmanagement unit; second processing for flushing the plurality of datawritten in the first storing area to the second input buffer in secondmanagement unit as data in second management unit that is twice or alarger natural number times as large as the first management unit; thirdprocessing for flushing the plurality of data written in the firststoring area to the first input buffer in logical block unit as data inthe second management unit; fourth processing for flushing a pluralityof data written in the second storing area to the first input buffer inlogical block unit; fifth processing for relocating a plurality of datawritten in the first input buffer to the third storing area in logicalblock unit; and sixth processing for relocating a plurality of datawritten in the second input buffer to the third storing area.
 2. Thememory system according to claim 1, wherein the controller allocates thestorage area of the nonvolatile semiconductor memory to the first inputbuffer in logical block unit.
 3. The memory system according to claim 2,wherein the controller executes the fifth processing when a number oflogical blocks allocated to the first input buffer has exceeded atolerance value.
 4. The memory system according to claim 2, wherein thesecond input buffer includes: a pre-stage buffer into which the data inthe second management unit that has been flushed from the first storingarea during the second processing is written in an additional manner;and a post stage buffer that is interposed between the pre-stage bufferand the third storing area and that separately stores the data with ahigh update frequency, and the controller executes the sixth processingfor relocating the plurality of data written in the pre-stage buffer tothe post stage buffer in logical block unit.
 5. The memory systemaccording to claim 4, wherein the post stage buffer is made up of aplurality of logical blocks managed in a first-in-first-out (FIFO)structure, the controller allocates the storage area of the nonvolatilesemiconductor memory to the pre-stage buffer and the post stage bufferin logical block unit, and the controller executes seventh processingfor relocating valid data in a logical block that was registered intothe post stage buffer earliest to the third storing area in logicalblock unit.
 6. The memory system according to claim 5, wherein thecontroller executes the seventh processing when a number of logicalblocks allocated to the post stage buffer has exceeded a tolerancevalue.
 7. The memory system according to claim 5, wherein in a casewhere a number of logical blocks allocated to the third storing area hasexceeded a tolerance value, the controller executes eighth processingfor selecting a plurality of valid data in the second management unitstored in the third storing area and rewriting the selected valid datainto a new logical block.
 8. The memory system according to claim 2,wherein the controller executes the fourth processing when a number oflogical blocks allocated to the second storing area has exceeded atolerance value.
 9. The memory system according to claim 8, wherein in acase where a number of logical blocks allocated to the second storingarea has exceeded a tolerance value, the controller executes ninthprocessing for selecting a plurality of valid data in the firstmanagement unit stored in the second storing area and rewriting theselected valid data into a new logical block.
 10. The memory systemaccording to claim 2, wherein in a case where a number of data in thesecond management unit that data in the first storing area belongs tohas exceeded a specified value, the controller executes the first, thesecond, or the third processing.
 11. A memory system comprising: a firststoring area as a cache memory included in a volatile semiconductormemory; second, third, and fourth storing areas included in anonvolatile semiconductor memory in which data reading and writing isperformed by a page unit and data erasing is performed by a physicalblock unit that is twice or larger natural number times as large as thepage unit; a first input buffer included in the nonvolatilesemiconductor memory that functions as an input buffer for the thirdstoring area; a second input buffer included in the nonvolatilesemiconductor memory that functions as an input buffer for the thirdstoring area and that separately stores data with a high updatefrequency for the third storing area; and a controller that allocates astorage area of the nonvolatile semiconductor memory to the second,third, and fourth storing areas in logical block unit associated withone or more of physical blocks, wherein the controller executes: firstprocessing for flushing a plurality of data in sector unit written inthe first storing area to the second storing area as data in firstmanagement unit; second processing for flushing the plurality of datawritten in the first storing area to the second input buffer in secondmanagement unit as data in second management unit that is twice or alarger natural number times as large as the first management unit; thirdprocessing for flushing the plurality of data written in the firststoring area to the first input buffer in logical block unit as data inthe second management unit; fourth processing for flushing a pluralityof data stored in the second storing area to the first input buffer inlogical block unit; fifth processing for flushing the plurality of datastored in the second storing area to the second input buffer in thesecond management unit as data in the second management unit; sixthprocessing for relocating, after executing the fourth or the fifthprocessing, the plurality of data stored in the second storing area tothe fourth storing area in logical block unit; seventh processing forflushing a plurality of data stored in the fourth storing area to thefirst input buffer in logical block unit; eighth processing forrelocating a plurality of data written in the first input buffer to thethird storing area in logical block unit; and ninth processing forrelocating a plurality of data written in the second input buffer to thethird storing area.
 12. A memory system comprising: a first storing areaas a cache memory included in a volatile semiconductor memory; secondand third storing areas included in a nonvolatile semiconductor memoryin which data reading and writing is performed by a page unit and dataerasing is performed by a physical block unit that is twice or largernatural number times as large as the page unit; a controller thatallocates a storage area of the nonvolatile semiconductor memory to thesecond and third storing areas in logical block unit associated with oneor more of physical blocks, wherein the controller executes: firstprocessing for flushing a plurality of data in sector unit written inthe first storing area to the second storing area as data in firstmanagement unit; second processing for flushing a plurality of datawritten in the first storing area to the third storing area in secondmanagement unit that is twice or a larger natural number times as largeas the first management unit; third processing for selecting a pluralityof valid data in the first management unit stored in the second storingarea and rewriting the valid data into a new logical block; and fourthprocessing for flushing, before executing the third processing, aplurality of data written in the second storing area to the thirdstoring area in logical block unit.
 13. The memory system according toclaim 12, wherein in a case where a number of logical blocks allocatedto the second storing area has exceeded a tolerance value, thecontroller executes the third and fourth processing.
 14. The memorysystem according to claim 12, wherein during the fourth processing, thecontroller selects the data to be flushed to the third storing areawhile giving a higher priority to data in the second management unitthat contains a larger number of valid data in the first managementunit.
 15. The memory system according to claim 12, wherein during thefourth processing, the controller selects the data to be flushed to thethird storing area while giving a higher priority to data in the secondmanagement unit that belongs to a logical block containing a smallernumber of valid data in the second management unit.
 16. The memorysystem according to claim 12, wherein during the fourth processing, thecontroller selects the data to be flushed to the third storing areawhile giving a higher priority to data in the second management unitthat contains a larger number of valid data in the first management unitand belongs to a logical block containing a smaller number of valid datain the second management unit.
 17. A memory system comprising: a firststoring area as a cache memory included in a volatile semiconductormemory; second, third, and fourth storing areas included in a thenonvolatile semiconductor memory in which data reading and writing isperformed by a page unit and data erasing is performed by a physicalblock unit that is twice or larger natural number times as large as thepage unit; and a controller that allocates a storage area of thenonvolatile semiconductor memory to the second, third, and fourthstoring areas in logical block unit associated with one or more ofphysical blocks, wherein the controller executes: first processing forflushing a plurality of data in sector unit written in the first storingarea to the second storing area as data in first management unit; secondprocessing for flushing a plurality of data written in the first storingarea to the third storing area as data in second management unit that istwice or a larger natural number times as large as the first managementunit; third processing for flushing a plurality of data written in thesecond storing area to the third storing area as data in the secondmanagement unit; fourth processing for relocating, after executing thethird processing, a plurality of data stored in the second storing areato the fourth storing area in logical block unit; fifth processing forselecting a plurality of valid data in first management unit stored inthe fourth storing area and rewriting the selected valid data into a newlogical block; and sixth processing for flushing, before executing thefifth processing, a plurality of data written in the fourth storing areato the third storing area in logical block unit.
 18. The memory systemaccording to claim 17, wherein in a case where a number of logicalblocks allocated to the fourth storing area has exceeded a tolerancevalue, the controller executes the fifth and sixth processing.
 19. Thememory system according to claim 18, wherein during the sixthprocessing, the controller selects the data to be flushed to the thirdstoring area while giving a higher priority to data in the secondmanagement unit that contains a larger number of valid data in the firstmanagement unit and belongs to a logical block containing a smallernumber of valid data in the second management unit.
 20. The memorysystem according to claim 19, wherein the first management unit is anatural number times as large as the sector unit, whereas the page unitis twice or a larger natural number times as large as the firstmanagement unit, and the second management unit is twice or a largernatural number times as large as the page unit, whereas the block unitis twice or a larger natural number times as large as the secondmanagement unit.